npm install报 ERESOLVE unable to resolve dependency tree

三四年前的一个项目,打开,npm install 一下,结果报 ERESOLVE unable to resolve dependency tree
以前install都一切顺利,现在就不行,那很大的可能是npm的版本不同。

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:

'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的版本。

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
当你在使用npm安装依赖时,如果出现"npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree"的错误信息,它表示npm无法解析依赖树。这通常是由于依赖关系冲突造成的。解决这个问题的方法有两种:修复依赖关系冲突或重新执行npm install命令。 修复依赖关系冲突的方法是,你可以尝试使用--force或--legacy-peer-deps选项,这样可以接受不正确的(可能被破坏的)依赖解析。但是需要注意,这可能会导致其他问题,所以在使用这些选项之前,请确保你已经了解了它们可能带来的潜在影响。 另外,有时候这个错误可能与eslint版本不兼容有关。你可以尝试通过更新eslint或相关的插件来解决这个问题。例如,根据错误提示 "peerDependencies WARNING eslint-plugin-vue@^5.2.3 requires a peer of eslint@^5.0.0" ,你可以尝试更新eslint和eslint-plugin-vue的版本,确保它们符合要求。 总结起来,当出现"npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree"的错误信息时,你可以尝试修复依赖关系冲突或重新执行npm install命令,并根据错误提示更新相关依赖的版本。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree](https://blog.csdn.net/yqx_123/article/details/118787849)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [npm install错peerDependencies WARNING eslint-plugin-vue@^5.2.3 requires a peer of eslint@^5.0.0 ...](https://download.csdn.net/download/weixin_38693311/14040615)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

科学熊

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值