When running npm i in one of my projects I get the follow error:
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.
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?
This is a known issue, seems like author dropped support for this package.
You can replace with forked one to solve this problem, created by #steima
https://www.npmjs.com/package/#steima/react-qr-barcode-scanner
npm update ; npm i --force
secondly. your next option is clear package.json. and npm init. and try installing latest versions of all dependencies. and never upgrade until absolutely necessary.
Related
I just updated firebase functions with this function npm i firebase-functions#latest, and updated npm install -g firebase-tools. And suddenly I have unabled to deploy all of my functions at firebase deploy --only functions. I got all of these errors:
Build failed: npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: firebase-functions-test#0.2.3
npm ERR! Found: firebase-functions#4.0.0-rc.0
npm ERR! node_modules/firebase-functions
npm ERR! firebase-functions#"^4.0.0-rc.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer firebase-functions#">=2.0.0" from firebase-functions-test#0.2.3
npm ERR! node_modules/firebase-functions-test
npm ERR! dev firebase-functions-test#"^0.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: firebase-functions#3.24.1
npm ERR! node_modules/firebase-functions
npm ERR! peer firebase-functions#">=2.0.0" from firebase-functions-test#0.2.3
npm ERR! node_modules/firebase-functions-test
npm ERR! dev firebase-functions-test#"^0.2.0" 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!
npm ERR! See /www-data-home/.npm/eresolve-report.txt for a full report.
Anyone know what's happening? I have tried this function on stackoverflow, but no luck at all. npm install --legacy-peer-deps Please help me! I have been like this for two days!
The issue that you're encountering is that firebase-functions-test specifies that it needs firebase-functions at at version >=2.0.0. npm interprets this as "stable versions greater than or equal to 2.0.0". That means versions like 3.24.1, 3.0.0, 2.3.1 would all be valid, but things like 4.0.0-rc.0 or a hypothetical 5.9.3-beta would not.
When you ran npm i firebase-functions#latest, it grabbed the version that the devs had tagged as "latest", which was 4.0.0-rc-0, which does not satisfy the aforementioned constraint.
I'd recommend explicitly installing a stable version (npm install firebase-functions#3.24.1), or -if you have access to firebase-functions-test- modify that package's package.json to specify "firebase-functions": ">=2.0.0 || 4.0.0-rc.0".
Check out the npm semver calculator to see what specifiers match which versions.
PS C:\Users\misss\tnodejs_ec> npm install #material-ui/core
npm WARN config global --global, --local are deprecated. Use --location=global instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: tnodejs_ec#0.1.0
npm ERR! Found: react#18.2.0
npm ERR! node_modules/react
npm ERR! react#"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^16.8.0 || ^17.0.0" from #material-ui/core#4.12.4
npm ERR! node_modules/#material-ui/core
npm ERR! #material-ui/core#"*" 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!
npm ERR! See C:\Users\misss\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\misss\AppData\Local\npm-cache_logs\2022-07-04T09_27_24_111Z-debug-0.log
PS C:\Users\misss\tnodejs_ec>
If you really want to install material UI then use force to npm no matter what happen you have to install this forcefully.
npm install #material-ui/core --force
MUI doesn't work with React18, its because of an issue in previous release of MUI, now its been fixed in the latest version.
If you want to stick to #material-ui/core#4.12.4 then your best bet is to include the --legacy-peer-deps option. I got it working after adding this option like
npm install #material-ui/core --legacy-peer-deps
However, the best way forward is to update to the latest MUI version. Current version of MUI is v5.10.1
PS: with recent updates the name of the package in NPM registry has been updated too
old: #material-ui/core
new: #mui/material
Don't forget to update your package.json
After running npx npm-check-updates -u I tried running npm install, and got the following message:
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: #nestjs/typeorm#8.0.3
npm ERR! node_modules/#nestjs/typeorm
npm ERR! #nestjs/typeorm#"^8.1.4" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! #nestjs/typeorm#"^8.1.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: typeorm#0.3.6
npm ERR! node_modules/typeorm
npm ERR! peer typeorm#"^0.3.0" from #nestjs/typeorm#8.1.4
npm ERR! node_modules/#nestjs/typeorm
npm ERR! #nestjs/typeorm#"^8.1.4" 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've searched and seen people recommend just using --legacy-peer-deps or --force, but is it supposed to be solved that way? Or am I supposed to manually fix the issue?
I tried searching for guides on how to resolve dependency tree errors but couldn't find any. Could you give me some guidance on where should I start with resolving the errors.
Here is the discussion about the issue with incompatible versions between nestjs/typeorm and typeorm. if you want to keep use the old version, try to use the fix version with:
"#nestjs/typeorm": "8.0.4",
"typeorm": "0.2.40",
Reinstall the packages, and it should fix the issue.
i fixed it by do following steps:
restart computer
delete and clone project again
npm i again and anything is good
The error as follows:
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: webpack#3.12.0
npm ERR! node_modules/webpack
npm ERR! dev webpack#"^3.5.6" from the root project
npm ERR! peer webpack#"2 || 3 || 4" from _babel-loader#7.1.5#babel-loader#7.1.5
npm ERR! node_modules/_babel-loader#7.1.5#babel-loader
npm ERR! 5 more (_html-webpack-plugin#2.30.1#html-webpack-plugin, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer webpack#"^2.0.0" from _strip-pragma-loader#1.0.0#strip-pragma-loader#1.0.0
npm ERR! node_modules/_strip-pragma-loader#1.0.0#strip-pragma-loader
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!
npm ERR! See /home/agou-ops/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/agou-ops/.npm/_logs/2021-04-12T02_49_11_062Z-debug.log
debug.log file content:
packge version and system
npm: 7.6.3
webpack: 3.12.0
system: Ubuntu 20.04
How should I fix it?
npm#7 has stricter dependency resolution than previous versions. If you can update the version of webpack in your root project, that may resolve it. An alternative easy quick thing to try is npm install --legacy-peer-deps.
I met the same problem.
try to run the command with --force , if you don't use the related package.
e.g.
npm install --verbose --force
For npm v7+. It is due to missing dependencies for entries mentioned in the package.json file
use:
npm i --force
or
npm i --legacy-peer-deps
to override peer dependency.
Answered in
Downgrade to a lower npm version with, for example,
npm install npm#6
I'm having trouble figuring out how to resolve a dependency related issue I'm having. I'm trying to install the npm module react-native-spotify-remote within a fresh React Native project and I am getting the following error:
$ npx react-native init test && cd test
$ npm i --save react-native-spotify-remote
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: test#0.0.1
npm ERR! Found: react-native#0.63.3
npm ERR! node_modules/react-native
npm ERR! react-native#"0.63.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react-native#"^0.61.5" from react-native-spotify-remote#0.3.2
npm ERR! node_modules/react-native-spotify-remote
npm ERR! react-native-spotify-remote#"*" 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!
npm ERR! See C:\Users\xxx\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxx\AppData\Local\npm-cache\_logs\2020-11-15T13_40_38_674Z-debug.log
As I read this error, it seems to me that it is saying that react-native-spotify-remote has a dependency of react-native at version 0.61.5 or higher, and version 0.63.3 is installed. Does that not mean the dependency is satisfied? I know that by downgrading react-native to an earlier version, as used in their example app, I could probably resolve this issue, but I want to try understand why this won't work first and I would ideally like to use the latest version.
Using the --force or --legacy-peer-deps flags does not solve the issue either.
I've also opened an issue on the GitHub repo but no luck there so far either.
Looks like it’s a problem with Peer Dependencies with npm, try:
npm install --legacy-peer-deps