【webpack 中版本兼容性问题错误总结,耽误半天学习】

【webpack版本兼容性问题错误总结,耽误半天学习】

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

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

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

3. npm WARN [email protected] 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 [email protected] requires a peer of webpack@^4.x.x but none is installed. You must install peer dependencies yourself.

2

npm WARN [email protected] requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] 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

参考资料:

版本不兼容https://blog.csdn.net/weixin_39495540/article/details/79740790

https://www.cnblogs.com/carrotWu/p/8665720.html

https://www.npmjs.com/package/webpack-cli

你可能感兴趣的:(前端学习)