在我的一个项目中运行npm i时,我会得到以下错误:
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@"^16.13.1" from react-qr-barcode-scanner@1.0.6
npm ERR! node_modules/react-qr-barcode-scanner
npm ERR! react-qr-barcode-scanner@"*" 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.我读过关于覆盖属性在package.json中的文章,但这似乎只适用于覆盖“常规”依赖项。
我也知道,我可以像错误提示的那样简单地运行npm i --legacy-peer-deps,但我不禁想知道:
在不需要--legacy-peer-deps**?**的情况下,是否有一种方法可以覆盖依赖项对等依赖项
发布于 2022-09-16 02:50:24
这是一个已知的问题,似乎作者放弃了对这个包的支持。
你可以用叉子代替它来解决这个问题,由@steima创建
https://www.npmjs.com/package/@steima/react-qr-barcode-scanner
发布于 2022-09-14 19:44:08
npm update ; npm i --force
第二步。您的下一个选项是明确的package.json。以及国家预防机制。并尝试安装所有依赖项的最新版本。永远不要升级直到绝对必要。
https://stackoverflow.com/questions/72270496
复制相似问题