下面错误提示

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: mirror-manager@3.8.0
npm ERR! Found: monaco-editor@0.20.0
npm ERR! node_modules/monaco-editor
npm ERR!   monaco-editor@"^0.20.0" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer monaco-editor@"0.25.x || 0.26.x || 0.27.x || 0.28.x" from monaco-editor-webpack-plugin@4.2.0
npm ERR! node_modules/monaco-editor-webpack-plugin
npm ERR!   dev monaco-editor-webpack-plugin@"^4.1.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! See /Users/xxx/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/xxx/.npm/_logs/2022-07-23T04_36_24_726Z-debug-0.log

原因:
ERESOLVE与npm@7有关的问题很常见,因为npm7.x对某些事情比npm6.x更严格。
通常,最简单的解决方法是将–legacy-peer-deps标志传递给npm(e.g.,npm i --legacy-peer-deps),或者使用npm@6。

如果不能立即起作用,可以先删除node_modules和package-lock.json。执行时会被重新创建

解决方案
降级npm到6版本或使用npx指定npm的版本

npx -p npm@6 npm i --legacy-peer-deps
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐