npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!文章來(lái)源:http://www.zghlxwxcb.cn/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!
原因可能是因?yàn)橹鞍惭b的react?是全局安裝的16,新項(xiàng)目用的是18所以依賴項(xiàng)中存在無(wú)法解決的沖突。
解決:npm i --legacy-peer-deps
就可解決了!文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-654941.html
到了這里,關(guān)于處理npm install 因版本問(wèn)題導(dǎo)致的報(bào)錯(cuò) (npm i --legacy-peer-deps)的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!