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

相关推荐
槑有老呆几秒前
从零搭建 LLM 流式对话前端:一文读懂 SSE、二进制流与 Vue 3 响应式
前端·javascript
没落英雄几秒前
7. 从零开始搭建一个 AI Agent —— UI 卡片渲染系统
前端·人工智能·架构
前端缘梦4 分钟前
LangGraph 核心特性技术详解:流式输出、持久化、记忆体系与中断实战。
前端·人工智能·程序员
张龙6877 分钟前
前端错误监控生产级方案:从 onerror 捕获到 Source Map 精准还原
前端·javascript
渣波7 分钟前
从零手写 Vite Mock 流式 AI 对话,搞懂 LLM 的“打字机”特效
前端·javascript
温柔过期啦9 分钟前
网站改了标题但是搜索引擎却没改?怎么样才能快速更新?
前端·搜索引擎·百度
cxxcode11 分钟前
JavaScript 模块化:从模块规范到打包原理
前端·webpack
驰子10512 分钟前
不重写、不换框架:让十年 jQuery 老项目写出 Vue 手感的渐进式改造
前端
Starry-sky(jing)13 分钟前
如何判断 Windows 是否安装 Node.js:三种方法 + 常见漏判场景
运维·windows·node.js·环境检测
月弦笙音14 分钟前
# SSE 连接可靠性方案
前端