When running npm i
in one of my projects I get the follow error:
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@"^16.13.1" from [email protected]
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.
I have read about the overrides property in package.json
but this only seems to work for overriding "regular" dependencies.
I do also know that I can simply run npm i --legacy-peer-deps
as the error suggests but I can't help but wonder:
Is there a way to override a dependencies peer dependencies without requiring --legacy-peer-deps
?
npm
v8 does not override peerDeps andnpm install
never succeeds for those conflicting peerDeps deep in my deps. – Onlybegottenreact-qr-barcode-scanner
as a direct dependency, consider using the forked project with updatedpackage.json
– Beefeater