您的位置:首页 > 产品设计 > UI/UE

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

2020-04-22 17:10 1266 查看

安装webpack和webpack-cli时出现的问题:
npm WARN webpack-cli@3.3.11 requires a peer of webpack@4.x.x but none is installed. You must install peer dependencies yourself.

问题翻译::
NPMWA RNwebpack-cli@3.3.11需要一个webpack@4.x.x的对等点,但没有安装。您必须自己安装对等依赖项。

原因:
安装时命令:npm install webpack -g
npm install webpack-cli -g
默认安装了webpack最新版本,导致安装的最新脚手架webpack-cli与webpack版本不匹配,导致安装错误
解决:

  1. 指定webpack安装版本:
npm install webpack@4.30.0 -g
  1. 指定webpack安装的版本如下:
npm install webpack-cli@3.3.2 -g
  1. 安装成功:
PS D:\developer\IdeaProjects\itcast-nodejs> npm install webpack@4.30.0 -g
D:\developer\node.js\npm_modules\webpack -> D:\developer\node.js\npm_modules\node_modules\webpack\bin\webpack.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\webpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

+ webpack@4.30.0
added 323 packages from 198 contributors in 27.276s
PS D:\developer\IdeaProjects\itcast-nodejs> npm install webpack-cli@3.3.2 -g
D:\developer\node.js\npm_modules\webpack-cli -> D:\developer\node.js\npm_modules\node_modules\webpack-cli\bin\cli.js

> webpack-cli@3.3.2 postinstall D:\developer\node.js\npm_modules\node_modules\webpack-cli
> node ./bin/opencollective.js

**Thanks for using Webpack!
Please consider donating to our Open Collective
to help us maintain this package.**

Donate: https://opencollective.com/webpack/donate

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

+ webpack-cli@3.3.2
added 206 packages from 126 contributors in 18.13s
在这里插入代码片
  • 点赞 1
  • 收藏
  • 分享
  • 文章举报
changleeei 发布了6 篇原创文章 · 获赞 1 · 访问量 1097 私信 关注
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: