npm install报 ERESOLVE unable to resolve dependency tree

三四年前的一个项目,打开,npm install 一下,结果报 ERESOLVE unable to resolve dependency tree。

以前install都一切顺利,现在就不行,那很大的可能是npm的版本不同。

javascript 复制代码
PS D:\workSpace\code\*-admin-ui-master> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: *-admin@0.1.0
npm ERR! Found: html-webpack-plugin@4.0.0-alpha
npm ERR! node_modules/html-webpack-plugin
npm ERR!   dev html-webpack-plugin@"4.0.0-alpha" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer html-webpack-plugin@"^3.0.0" from script-ext-html-webpack-plugin@2.0.1
npm ERR! node_modules/script-ext-html-webpack-plugin
npm ERR!   dev script-ext-html-webpack-plugin@"2.0.1" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\11703\AppData\Local\npm-cache\_logs\2023-11-02T07_24_59_256Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\11703\AppData\Local\npm-cache\_logs\2023-11-02T07_24_59_256Z-debug-0.log

查看logs:

javascript 复制代码
'Log files:
C:\Users\11703\AppData\Local\npm-cache\_logs\2023-11-02T07_24_59_256Z-debug-0.log

# npm resolution error report

While resolving: *-admin@0.1.0
Found: html-webpack-plugin@4.0.0-alpha
node_modules/html-webpack-plugin
  dev html-webpack-plugin@"4.0.0-alpha" from the root project

Could not resolve dependency:
peer html-webpack-plugin@"^3.0.0" from script-ext-html-webpack-plugin@2.0.1
node_modules/script-ext-html-webpack-plugin
  dev script-ext-html-webpack-plugin@"2.0.1" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

给出的建议是:npm install --force 或者 --legacy-peer-deps

或者使用npx -p npm@6 npm install --legacy-peer-deps指定npm的版本。

相关推荐
IT_陈寒3 分钟前
JavaScript的闭包陷阱,这个坑我躺了三天才爬出来
前端·人工智能·后端
计算机魔术师12 分钟前
Microsoft Research 与合作者证明 31 年历史的 KLS 猜想
前端
weixin_4173968320 分钟前
桌面云终端PXE启动失败怎么排查?从DHCP Option到镜像下发
开发语言·前端·php·技术·酒店·综合布线·弱电
林恒smileZAZ1 小时前
浏览器为什么加载不了超大图片
前端·vue.js·html5
hhwyqwqhhwy1 小时前
设备树之 provider 和 consumer
java·linux·前端
垆边人似月.3 小时前
Python中如何使用get函数实现频次查询
服务器·前端·python
moshuying3 小时前
DeepSeek开源生产级推理框架DeepInfer:单集群一天处理155万亿token,这意味着什么?
前端
子兮曰4 小时前
PHP漏洞危机,你的网站升级了吗?
前端·后端·php
jerrywus4 小时前
给 Pi 装上生图插件:从登录报错到画出一只 200×200 的猫
前端·agent·claude
陈随易4 小时前
搞钱点子之生态鱼缸
前端·后端·程序员