npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!文章来源:https://www.toymoban.com/news/detail-654941.html
npm ERR! While resolving: react-demo@0.1.0
npm ERR! Found: react@17.0.2
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/react@13.3.0
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
就可解决了!文章来源地址https://www.toymoban.com/news/detail-654941.html
到了这里,关于处理npm install 因版本问题导致的报错 (npm i --legacy-peer-deps)的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!