npm安装时出现ERESOLVE问题

发布时间 2023-04-17 13:07:14作者: 邢韬

npm i 安装时,经常会出现如下错误

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: jzyj2@0.1.0
npm ERR! Found: echarts@5.4.2
npm ERR! node_modules/echarts
npm ERR!   echarts@"^5.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer echarts@"^4.1.0" from echarts-gl@1.1.2
npm ERR! node_modules/echarts-gl
npm ERR!   echarts-gl@"^1.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!
npm ERR! For a full report see:
npm ERR! C:\Users\dell\AppData\Local\npm-cache\_logs\2023-04-17T04_54_59_038Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\dell\AppData\Local\npm-cache\_logs\2023-04-17T04_54_59_038Z-debug-0.log

解决方法

npm i --legacy-peer-deps

引用自:https://blog.csdn.net/weixin_42624898/article/details/123694722