I just updated all my node modules using npm-check-updates.
I did this so I could install the latest version ngx-stripe, which needed some updated node modules that I didn't have installed.
After updating all my node modules and then trying to install ngx-stripe I got this error below, showing me that ngx-gallery-9#1.0.6 has a peer dependency of tslib 1.10.0, which is true, but my installed version is tslib 2.5.0 in node modules.
QUESTION - Should I use --force or --legacy-peer-deps when running the npm install for ngx-stripe or is there something else I should try first like updating the tslib peer dependency for ngx-gallery-9?
Here is what I see:
➜ client git:(master) ✗ npm install ngx-stripe #stripe/stripe-js
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ngx-gallery-9#1.0.6
npm ERR! Found: tslib#2.5.0
npm ERR! node_modules/tslib
npm ERR! tslib#"^2.3.0" from #angular/animations#15.1.2
npm ERR! node_modules/#angular/animations
npm ERR! peerOptional #angular/animations#"15.1.2" from #angular/platform-browser#15.1.2
npm ERR! node_modules/#angular/platform-browser
npm ERR! peer #angular/platform-browser#"15.1.2" from #angular/forms#15.1.2
npm ERR! node_modules/#angular/forms
npm ERR! peer #angular/forms#"^11.2.11 || ^12.0.4 || ^13.0.0 || ^14.0.0 || ^15.0.0" from #zxing/ngx-scanner#3.8.0
npm ERR! node_modules/#zxing/ngx-scanner
npm ERR! 2 more (ngx-bootstrap, the root project)
npm ERR! 3 more (#angular/platform-browser-dynamic, #angular/router, the root project)
npm ERR! peer #angular/animations#"^15.0.0" from ngx-bootstrap#10.2.0
npm ERR! node_modules/ngx-bootstrap
npm ERR! ngx-bootstrap#"^10.2.0" from the root project
npm ERR! 1 more (the root project)
npm ERR! tslib#"^2.3.0" from #angular/common#15.1.2
npm ERR! node_modules/#angular/common
npm ERR! peer #angular/common#"15.1.2" from #angular/forms#15.1.2
npm ERR! node_modules/#angular/forms
npm ERR! peer #angular/forms#"^11.2.11 || ^12.0.4 || ^13.0.0 || ^14.0.0 || ^15.0.0" from #zxing/ngx-scanner#3.8.0
npm ERR! node_modules/#zxing/ngx-scanner
npm ERR! #zxing/ngx-scanner#"^3.8.0" from the root project
npm ERR! 2 more (ngx-bootstrap, the root project)
npm ERR! peer #angular/common#"^15.0.0 || ^16.0.0" from #angular/google-maps#15.1.2
npm ERR! node_modules/#angular/google-maps
npm ERR! #angular/google-maps#"^15.1.2" from the root project
npm ERR! 10 more (#angular/platform-browser, ...)
npm ERR! 20 more (#angular/compiler, #angular/compiler-cli, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer tslib#"^1.10.0" from ngx-gallery-9#1.0.6
npm ERR! node_modules/ngx-gallery-9
npm ERR! ngx-gallery-9#"^1.0.6" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: tslib#1.14.1
npm ERR! node_modules/tslib
npm ERR! peer tslib#"^1.10.0" from ngx-gallery-9#1.0.6
npm ERR! node_modules/ngx-gallery-9
npm ERR! ngx-gallery-9#"^1.0.6" 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!
npm ERR! For a full report see:
npm ERR! /Users/charles/.npm/_logs/2023-01-27T08_58_58_320Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/charles/.npm/_logs/2023-01-27T08_58_58_320Z-debug-0.log
➜ client git:(master) ✗
Your problem is completely unrelated to ngx-stripe, but whenever you run npm install, NPM tries to fix all of its dependencies in package.json at the same time, and because you have a problem with ngx-gallery-9, all npm installs are failing. You can ignore the error for now, using --legacy-peer-deps, which will tell NPM to not try to deal with peer dependencies and just let you install the thing you want to install (ngx-stripe).
With regards to fixing the error itself, there's not much you can do here. ngx-gallery-9 is using an older version of tslib, and hasn't been updated for a long time. There's currently an open bug requesting that the library maintainer update his packages.
More specifically,
Angular 15 requires tslib#"^2.3.0", but ngx-gallery-9 requires tslib#"^1.10.0". You can try forcing it to use the latest version by using --legacy-peer-deps during ALL your future npm installations, as well as running npm install tslib#^2.3.0 --save --legacy-peer-deps to manually choose to use the newer version, which will force the whole project to use tslib#"^2.3.0" and ignore ngx-gallery-9's complaints, but there's a strong possibility that ngx-gallery-9 won't work as expected.
Your best bet is to either
use a different gallery than ngx-gallery-9, or
Simply ignore the problem. Force everything to use tslib#"^2.3.0" with npm install tslib#^2.3.0 --save --legacy-peer-deps and hope ngx-gallery-9 won't have any errors, or
downgrade Angular to an earlier version (Which is very messy, and not really recommended unless you didn't intend to be using Angular 15).
Edit:
Or instead undo all the changes that npm-check-updates did, and instead just install an older version of ngx-stripe that's compatible with all of your packages. ngx-stripe has a chart showing which version to use depending on your version of Angular, here: https://www.npmjs.com/package/ngx-stripe
Just type:
npm install ngx-stripe #stripe/stripe-js --force
or npm install ngx-stripe #stripe/stripe-js--legacy-peer-deps
Related
This question already has an answer here:
Unable to Install and configure the MDX transformer plugin (and dependencies) in gatsby site
(1 answer)
Closed 24 days ago.
I'm getting the following errors while using the command npm install.
I'm new to gatsby and react don't know how resolve.
pegasus#pegasus:~/Documents/MyWebsite/blog-main$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: gatsby-plugin-mdx#5.5.0
npm ERR! Found: #mdx-js/react#1.6.22
npm ERR! node_modules/#mdx-js/react
npm ERR! #mdx-js/react#"^1.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #mdx-js/react#"^2.0.0" from gatsby-plugin-mdx#5.5.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! dev gatsby-plugin-mdx#"^5.5.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #mdx-js/react#2.2.1
npm ERR! node_modules/#mdx-js/react
npm ERR! peer #mdx-js/react#"^2.0.0" from gatsby-plugin-mdx#5.5.0
npm ERR! node_modules/gatsby-plugin-mdx
npm ERR! dev gatsby-plugin-mdx#"^5.5.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!
npm ERR! For a full report see:
npm ERR! /home/pegasus/.npm/_logs/2023-01-27T07_02_53_230Z-eresolve-report.txt
Seems, version compatibility issue, You have few options to resolve this issue:
Upgrade the version of #mdx-js/react package: You can try to upgrade the version of #mdx-js/react package in your project to a version that is compatible with gatsby-plugin-mdx by running the command npm install #mdx-js/react#2.x.x
Downgrade the version of gatsby-plugin-mdx package: You can try to downgrade the version of gatsby-plugin-mdx package in your project to a version that is compatible with the current version of #mdx-js/react package by running the command npm install gatsby-plugin-mdx#x.x.x.
Use --force or --legacy-peer-deps: You can also use npm install --force or npm install --legacy-peer-deps to ignore the peer dependency conflict and install the packages, but this option can lead to unexpected behavior and it's not recommended.
use npm install --legacy-peer-deps
I have no idea what I need to do to get NPM install to run successfully after upgrading Node to 18.12.1 and npm to 9.2.0. I keep getting this upstream dependency error. I ran
npm install -g npm-check-updates
ncu -u
npm install
And now this is where I am.
npm install ─╯
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: hipersigno#undefined
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#"^17.0.0" from react-svgmt#1.2.0
npm ERR! node_modules/react-svgmt
npm ERR! react-svgmt#"^1.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!
npm ERR! For a full report see:
npm ERR! /Users/mchildress/.npm/_logs/2023-01-09T16_27_29_875Z-eresolve-report.txt
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/mchildress/.npm/_logs/2023-01-09T16_27_29_875Z-debug-0.log
What's going on is that react-svgmt has react 17 set as a peer dependency. This means that it is built only to support react 17. You have react 18 installed and npm sees that conflict and bails. You have the following options:
Downgrade to React 17 by using npm install --save react#^17.0.0 react-dom#^17.0.0
Indicate that you are okay with having a potentially incompatible version by using npm install --legacy-peer-deps.
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
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 trying to build the playground app for react-native-navigation using instructions here. A simple npm install fails because the peer dependencies have react: "*" and react-native: "*", so today (Jan 2021) NPM tries to install react#17.0.1, but also tries to install react-native#0.63.4, which requires react#16.13.1. I get the following error:
npm ERR! While resolving: react-native-navigation#7.7.0
npm ERR! Found: react#17.0.1
npm ERR! node_modules/react
npm ERR! peer react#"*" from the root project
...
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.13.1" from react-native#0.63.4
npm ERR! node_modules/react-native
npm ERR! peer react-native#"*" from the root project
npm ERR! peer react-native#">=0.59" from #react-native-community/datetimepicker#2.6.2
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR!
Then I tried to resolve this by installing react#16.13.1 in my root project, hoping that NPM would detect and use that version as a peer dependency, but then it turns out #react-native-community/datetimepicker#2.6.2 depends on react-native-windows#^0.6.20, which depends on react#16.11.0, giving me this error instead:
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! dev react#"16.13.1" from the root project
...
npm ERR! Could not resolve dependency:
npm ERR! peer react#"16.11.0" from react-native-windows#0.62.20
npm ERR! node_modules/#react-native-community/datetimepicker/node_modules/react-native-windows
npm ERR! optional react-native-windows#"^0.62.0-0" from #react-native-community/datetimepicker#2.6.2
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! dev #react-native-community/datetimepicker#"^2.5.0" from the root project
npm ERR! 1 more (react-native-ui-lib)
npm ERR!
How do I get to the bottom of this? I was expecting everything to just work with npm install. What is the proper way to install a project, or is it common to have to constantly debug dependency conflicts prior to starting a project?
As it turns out, I was using node 15.0.x which is apparently too new. Downgrading to 14.15.1 worked.
I too was using node 15.0.x. Downgrading to 14.x.x worked.
Try doing npm install --legacy-peer-deps