Issue Fixed – The Upstream Dependency Conflict Installing NPM Packages

the upstream dependency conflict installing NPM packages

Node.js is a backend runtime environment of JavaScript. When working with a node, you may have ‘the upstream dependency conflict installing NPM packages’ error. Once you start using node.js, you need to install libraries to keep it working. Additional modules are needed to be installed as the node has no module when installed.

Today, we discuss how can we fix ‘the upstream dependency conflict installing NPM packages’ error when running a program. Let’s check out how to fix it

How To fix ‘the upstream dependency conflict installing NPM packages’

To fix the issue, there are a few ways that are quite effective. Have a look at the solutions but before that check out how error occurs

Error Occurs

This is how you get the error:

error code ERESOLVE
error ERESOLVE unable to resolve dependency tree
error While resolving: [1mexample[22m@[1m1.0.0[22m
error Found: [1mmapbox-gl[22m@[1m1.13.0[22m[2m[22m
error [2mnode_modules/mapbox-gl[22m
error   [1mmapbox-gl[22m@"[1m^1.13.0[22m" from the root project
error Could not resolve dependency:
error [35mpeer[39m [1mmapbox-gl[22m@"[1m^0.53.0[22m" from [1mvue-mapbox[22m@[1m0.4.1[22m[2m[22m
error [2mnode_modules/vue-mapbox[22m
error   [1mvue-mapbox[22m@"[1m*[22m" from the root project
error Fix the upstream dependency conflict, or retry
error this command with --force, or --legacy-peer-deps
error to accept an incorrect (and potentially broken) dependency resolution.
error See /Users/user/.npm/eresolve-report.txt for a full report.
verbose exit 1

The cause of the error is the peer dependency is the latest npm version (v7).

Solution 1 – Avoid the Peer Dependency

The effective solution to this error is to pass a command to the npm install that can help ignore the peer dependencies and continue the installation. To install the dependencies, pass the following command

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

If you want to set this permanently, then you can pass the below command to add this into a configuration

npm config set legacy-peer-deps true

Solution 2 – Apply -force

Another solution is to apply the flag –force. With the help of the  –force or -f argument, the npm will be forced to fetch resources that are remote even if it has a local copy on disk exist. To remove the node_modules, use the following command

rm -rf node_modules

You can remove the package-lock.json with this command:

rm package-lock.json

Once done, you just need to clear the cache and force install the npm. Follow the command below

npm cache clean --force
npm install --force

Solution 3 – Update npm and Audit fix

This one is also a solution to fix the issue. In order to update the npm and audit fix, you should run the command below

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


We have discussed the best possible solutions to fix ‘the upstream dependency conflict installing NPM packages’ issue. You can follow the step to solve the error and continue the program you are designing.

I hope you find it helpful!

Don’t forget to drop a comment below if you need help or even share your opinion!

Leave a Reply

Your email address will not be published. Required fields are marked *