首页 > 其他分享 >处理npm install 因版本问题导致的报错 (npm i --legacy-peer-deps)

处理npm install 因版本问题导致的报错 (npm i --legacy-peer-deps)

时间:2022-08-13 20:14:48浏览次数:86  
标签:npm ERR -- react legacy 报错 install peer

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.2" from the root project

npm ERR!

npm ERR! Could not resolve dependency:

npm ERR! peer react@"^18.0.0" from @testing-library/[email protected]

npm ERR! node_modules/@testing-library/react

npm ERR! @testing-library/react@"^13.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!

原因可能是因为之前安装的react 是全局安装的16,新项目用的是18所以依赖项中存在无法解决的冲突。
解决:npm i --legacy-peer-deps
就可解决了!

标签:npm,ERR,--,react,legacy,报错,install,peer
From: https://www.cnblogs.com/zhyp/p/16583923.html

相关文章

  • cmd下执行pytest报错找不到文件模块
     现象:ModuleNotFoundError:Nomodulenamed'common'  解决方案:文件开头加入代码importos,syssys.path.append(os.getcwd())如果你对自己没有观察,对自己没有觉......