npm install 即使在版本降级后也会出现 ERESOLVE 错误

问题描述 投票:0回答:1

更新:我通过这样做克服了这个问题

npm install --legacy-peer-deps

但仍然很好奇如何调整我的 package.json

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR!   react@"^17.0.0" from the root project
npm ERR!   peer react@">=17" from @coreui/[email protected]
npm ERR!   node_modules/@coreui/react
npm ERR!     @coreui/react@"^4.11.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^18.2.0" from [email protected]
npm ERR! node_modules/react-dom
npm ERR!   peer react-dom@">=17" from @coreui/[email protected]
npm ERR!   node_modules/@coreui/react
npm ERR!     @coreui/react@"^4.11.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! 
reactjs npm-install
1个回答
0
投票

根据上述错误消息,您正在使用需要

[email protected]
[email protected]
。但在您的项目中,您正在使用
[email protected]
。这会导致版本不匹配,从而导致错误。

要解决此问题,请安装

[email protected]

© www.soinside.com 2019 - 2024. All rights reserved.