npm - npm 依赖:webpack 的恶性循环
问题描述
尝试在本地设置现有项目。
当我运行时npm install
,它告诉我webpack@^4
缺少一个对等依赖项。
$ npm install
npm WARN css-loader@1.0.0 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN file-loader@1.1.11 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN friendly-errors-webpack-plugin@2.0.0-beta.2 requires a peer of webpack@^4.0.0 but none is installed. You must install peer dependencies yourself.
[...]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
然而,安装它会触发更多的依赖问题:
$ npm install --save webpack@4
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\watchpack-chokidar2\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN assets-webpack-plugin@7.0.0 requires a peer of webpack@>=5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN imports-loader@2.0.0 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader@11.0.1 requires a peer of webpack@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN terser-webpack-plugin@5.1.1 requires a peer of webpack@^5.1.0 but none is installed. You must install peer dependencies yourself.
[...]
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
解决这些问题的正确方法是什么?
解决方案
推荐阅读
- javascript - 更新现有列表而不重新加载整个页面
- ruby - 如何从类方法内定义的哈希映射中调用类外的哈希值?
- c# - 如何授予每个用户访问其个人文件夹的权限并阻止其他用户访问
- jquery - 如何自定义“require_from_group”错误消息并只显示一次?
- python - 当值的长度与索引的长度不匹配时,用 Nan 填充
- angular - 如何检测@Input 字符串的变化
- java - 保存在eclipse中的.java文件充满了空字符
- python - Sklearn Multilabel ML:ValueError:标签二值化不支持多输出目标数据
- elasticsearch - match_phrase_prefix 查询不适用于嵌套聚合
- xml - Xslt 1.0 如果来自节点的元素值为真,则从同一节点获取另一个元素的值