问题:npm错误!代码解析   npm错误!ERESOLVE无法解析依赖关系树

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree    
npm ERR!
npm ERR! While resolving: ant-design-pro@2.3.1
npm ERR! Found: react@16.14.0
npm ERR! node_modules/react
npm ERR!   react@"^16.7.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^15.0.0" from react-fittext@1.0.0
npm ERR! node_modules/react-fittext
npm ERR!   react-fittext@"^1.0.0" 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 D:\tool\toolPath\nodejs\node_cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     D:\tool\toolPath\nodejs\node_cache\_logs\2022-04-28T02_01_32_072Z-debug.log

百度翻译的意思:

原因:

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

如果这不能立即起作用,也许可以先删除node_modules和package-lock.json。它们将被重新创建。

解决方案:

降级npm到6版本,在终端运行以下命令

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

 如果觉得可以就点个👍吧,欢迎粉丝收藏,土豪打赏,你的鼓励将是我创作的最大动力!

qq群933053581

Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐