webpack报错3

关于安装 html-webpack-plugin后打包时出现的问题

报错代码:

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mywebpack@1.0.0 dev: webpack-dev-server
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mywebpack@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lenovo\AppData\Roaming\npm-cache_logs\2021-04-08T12_37_10_699Z-debug.log
npm WARN webpack-cli@3.3.12 requires a peer of webpack@4.x.x but none is installed. You must install peer dependencies yourself.
npm WARN mywebpack@1.0.0 No description
npm WARN mywebpack@1.0.0 No repository field.

removed 223 packages and audited 312 packages in 18.102s

13 packages are looking for funding

found 0 vulnerabilities

报错信息:

解决:

查阅资料好像是webpack版本太高的问题,所以我就先使用

npm uninstall webpack

把原来的 webpack 卸载,再 使用

npm install webpack@4.20.2 -D

下载比原来更低的 webpack 版本。最后可以成功打包。
关于webpack版本与其各插件版本之间的兼容问题,本人也不太理解,仍需努力。

posted @ 2021-04-08 21:37  黛黛318  阅读(598)  评论(0编辑  收藏  举报