Luz*_*uze 8 node.js npm node-modules package.json peer-dependencies
在我的一个项目中运行时,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.
Run Code Online (Sandbox Code Playgroud)
我已阅读有关overrides属性的内容,package.json但这似乎仅适用于覆盖“常规”依赖项。
我也知道我可以简单地npm i --legacy-peer-deps按照错误提示运行,但我忍不住想知道:
有没有一种方法可以覆盖依赖项对等依赖项而不需要--legacy-peer-deps?
nik*_*ami -1
npm update ; npm i --force
第二。您的下一个选项是清除 package.json。和 npm 初始化。并尝试安装所有依赖项的最新版本。除非绝对必要,否则切勿升级。
| 归档时间: |
|
| 查看次数: |
1908 次 |
| 最近记录: |