webpack 中版本兼容性问题错误总结

时间:2023-12-27 17:08:37

一定不要运行npm i  XXX  -g(-d) 一定要指定版本,尽量低版本,也不最新版本,会导致不兼容和指令不一样的问题。

1.安装webpack-dev-server 报错,说需要webpack-cli,原因,这两个之中某一个版本太高。,重新安装低版本

2.安装webpack-cli ,然后还是不能使用,

3. npm WARN webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.。。说明安装的Webpack版本太高,切换到,---》》》》》》》》》"webpack": "^3.6.0",

4.最后安装 "webpack-cli": "^3.0.0",

5.安装"webpack-dev-server": "^2.9.1"

报错总结:

【1】

npm WARN webpack-cli@3.0.8 requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.

【2】

npm WARN webpack-dev-middleware@3.1.3 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN webpack-dev-server@3.1.4 requires a peer of webpack@^4.0.0-beta.1 but none is installed. You must install peer dependencies yourself.

【3】

C:\Apache24\htdocs\example\Aproject\test\first-day\Vue-study\02-day\web-pack

> webpack-dev-server

The CLI moved into a separate package: webpack-cli.

Please install 'webpack-cli' in addition to webpack itself to use the CLI.

-> When using npm: npm install webpack-cli -D

-> When using yarn: yarn add webpack-cli -D
---------------------
作者:不正经的前端程序员
来源:CSDN
原文:https://blog.csdn.net/qq_27300101/article/details/80932670?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!