一定不要运行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:Apache24htdocsexampleAprojecttestfirst-dayVue-study 2-dayweb-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