Fix the upstream dependency conflict installing NPM packages

Javascriptnode.jsNpmDependenciesMapbox

Javascript Problem Overview


Trying to npm install vue-mapbox mapbox-gl and I'm getting a dependency tree error.

I'm running Nuxt SSR with Vuetify, and haven't installed anything related to Mapbox prior to running this install and getting this error.

38 error code ERESOLVE
39 error ERESOLVE unable to resolve dependency tree
40 error
41 error While resolving: example@1.0.0
41 error Found: mapbox-gl@1.13.0
41 error node_modules/mapbox-gl
41 error   mapbox-gl@"^1.13.0" from the root project
41 error
41 error Could not resolve dependency:
41 error peer mapbox-gl@"^0.53.0" from vue-mapbox@0.4.1
41 error node_modules/vue-mapbox
41 error   vue-mapbox@"*" from the root project
41 error
41 error Fix the upstream dependency conflict, or retry
41 error this command with --force, or --legacy-peer-deps
41 error to accept an incorrect (and potentially broken) dependency resolution.
41 error
41 error See /Users/user/.npm/eresolve-report.txt for a full report.
42 verbose exit 1

What's the right way to go about fixing this upstream dependency conflict?

Javascript Solutions


Solution 1 - Javascript

Looks like it's a problem with Peer Dependencies in the latest version of npm (v7) which is still a beta version. try with npm install --legacy-peer-deps for detail info check this https://blog.npmjs.org/post/626173315965468672/npm-v7-series-beta-release-and-semver-major

Solution 2 - Javascript

Use --legacy-peer-deps after npm install. For example, if you want to install radium, use:

npm install --legacy-peer-deps --save radium

Solution 3 - Javascript

There are TWO ways:

  1. use npm install --legacy-peer-deps to install, and if this doesn't work use

  2. force method. add --force next to npm install: npm install --force

Solution 4 - Javascript

until npm version 7.19.1 still have same issue, after upgraded to version 7.20.3 use command npm install -g npm@latest and npm audit fix all pkgs fixed without error.

Solution 5 - Javascript

You can follow this command

first type:

npm config set legacy-peer-deps true

then type:

npx create-react-app my-app

Solution 6 - Javascript

  • delete the package-lock.json file
  • modify the package.json , updating the version as indicated by the peer dependancy
  • run npm install or npm udpate

Solution 7 - Javascript

To Solve Fix the upstream dependency conflict installing NPM packages Error

Method 1. Just Use --legacy-peer-deps after npm install.

For example, if you want to install axios, use

npm install --legacy-peer-deps --save axios.

Method 2. Updating npm and audit fix

npm I -g npm@latest
npm audit fix --force

Method 3. using --force to install packages

npm install axios --force

Solution 8 - Javascript

I tried multiple ways but nothing was working for me. At last tried this and it worked npm config set legacy-peer-deps true Run this in the project folder and then try to install any package. Might work for you as well

Solution 9 - Javascript

I have downgraded my node version to 10.23.1 it worked fine.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionconnorcodeView Question on Stackoverflow
Solution 1 - JavascriptSultan MaulanaView Answer on Stackoverflow
Solution 2 - JavascriptShivam YadavView Answer on Stackoverflow
Solution 3 - Javascripthatake kakashiView Answer on Stackoverflow
Solution 4 - JavascriptStupiCodeView Answer on Stackoverflow
Solution 5 - JavascriptMd Sajedul IslamView Answer on Stackoverflow
Solution 6 - JavascriptMatoeilView Answer on Stackoverflow
Solution 7 - Javascriptconfused_View Answer on Stackoverflow
Solution 8 - Javascriptuser15842079View Answer on Stackoverflow
Solution 9 - Javascriptyogesh clView Answer on Stackoverflow