Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.8K
Views
Unable to resolve dependency tree error when installing npm packages

When trying to install the npm packages using npm i command, I am getting the following exception:

Enter image description here

I have tried reinstalling the Node.js package and setting the proxy to off using:

set HTTP_PROXY=
set HTTPS_PROXY=

The issue is still there. What I am doing wrong?

Update:

When I run the following command:

npm install --legacy-peer-deps

The following error is displayed:

Enter image description here

over 4 years ago · Santiago Trujillo
35 answers
Answer question

0

This is not related to an HTTP proxy.

You have dependency conflict (incorrect and potentially broken dependency) as it says, so try to run the command with --force, or --legacy-peer-deps. If it doesn't take effect, the temporary solution is using prior versions of the Node.js (downgrading the Node.js version) as it causes this kind of errors to happen sometimes.

Update based on the OP's update:

As you see, it fires the following error:

No matching version found for @angular/http@^9.1.4.

Take a look at angular/http page. Note that the latest version for that deprecated package is 7.2.16 while you request an upper version (e.g., ^9.1.4)! So, try to check the project dependencies and follow the raised errors in order to solve the problem.

over 4 years ago · Santiago Trujillo Report

0

When using npm 7, this comes up a lot because peer dependencies issues are treated as errors in version 7 whereas they were generally only warnings in version 6. Usually using --legacy-peer-deps makes it work with npm 7.

When that doesn't work, an option is to downgrade to npm 6. Downgrading Node.js is not necessary (but not harmful either). The relevant dependency management code is in npm. Downgrading Node.js will often work coincidentally because doing so will often downgrade npm as well.

Another option that is less disruptive than downgrading npm is using npx to use the previous version of npm for just the install command: npx -p npm@6 npm install

And when all else fails, it's often worth a shot to remove the node_modules directory and package-lock.json, and then run npm install again. That regenerates node_modules and package-lock.json.

over 4 years ago · Santiago Trujillo Report

0

The problem seems to be that gf-kautomata-pipeline-ui is using Angular 9, while @angular/http requires Angular 7. (@angular/http was deprecated and eventually removed, and all its functionality was moved into @angular/common instead.)

See: https://www.npmjs.com/package/@angular/http

If you're running Angular 9, then

  1. delete @angular/http from your package.json (You don't need it in Angular 9)

  2. Make sure you have @angular/common in your package.json.

  3. Run npm i.

If you're running Angular 7, then open up your package.json and check to make sure all of your Angular packages are no higher than ^7.0.0. You may also need remove gf-kautomata-pipeline-ui, or contact the author of gf-kautomata-pipeline-ui and find out if the library is compatible with Angular 7.

over 4 years ago · Santiago Trujillo Report

0

Try removing the node modules and package-lock.json file and run command npm install or Try npm cache clean --force

over 4 years ago · Santiago Trujillo Report

0

Try this command-

npm install --save --legacy-peer-deps
over 4 years ago · Santiago Trujillo Report

0

I finally found a solution:

  • install nvm
  • use nvm to install Node.js
  • enter cmd to use the LTS version
  • after that, my installation worked. It should be working for you too.
over 4 years ago · Santiago Trujillo Report

0

In addition to using the --legacy-peer-deps command line option, this can also be set more permanently as a config option:

npm config set legacy-peer-deps true
over 4 years ago · Santiago Trujillo Report

0

This happens for some packages after updating to npm 7.

Paramter --legacy-peer-deps can help:

npm i --legacy-peer-deps

Described here legacy-peer-deps

Causes npm to completely ignore peerDependencies when building a package tree, as in npm versions 3 through 6.

If a package cannot be installed because of overly strict peerDependencies that collide, it provides a way to move forward resolving the situation.
...

You can set this option to true by default (not recommended by npm):

npm config set legacy-peer-deps true

Or just wait until these packages get up to date.

over 4 years ago · Santiago Trujillo Report

0

None of the previous answers helped me.

For me, updating npm to the latest version (to 7.11.1 from 7.8) using npm i -g npm fixed the issue for me.

over 4 years ago · Santiago Trujillo Report

0

  1. Add the dependency in file package.json
  2. Do npm install

Still seeing the error? Then

npm install --force`
over 4 years ago · Santiago Trujillo Report

0

I solved this with by lowering the version of Node.js from the last version to the LTS version.

over 4 years ago · Santiago Trujillo Report

0

I had the same issue

npm install --legacy-peer-deps

This works for mine too. But I have a simpler answer. Just change the version number of it in the package.json file that is required. Then use

npm i

This will solve your problem (generate a new project as usual, without any potentially broken dependency issue).

over 4 years ago · Santiago Trujillo Report

0

Resetting package-lock.json works good for me all the time:

git checkout -- package-lock.json

Details: Been experiencing this a lot when updating all packages of the legacy project - I highly don't recommend using npm audit fix nor npm i --force. Deleting the package-lock.json didn't work for me all the time as well. Rollback to the working version of package.json + package-lock.json and add packages turned out to be the safest and fastest variant for me.

over 4 years ago · Santiago Trujillo Report

0

First I tried

npm install

It gave me error unable to resolve dependency tree and based on the help information from this command,

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 tried this command:

npm install --legacy-peer-deps

And it solved my problem.

over 4 years ago · Santiago Trujillo Report

0

In my case I was having trouble with a @babel/core dependency, but I didn't want to use --force, because I was not sure about the consequences, so I went to https://www.npmjs.com/, looked for the package and replaced my old version with the newest one. That did the work.

over 4 years ago · Santiago Trujillo Report

0

Just Do Simple thing:

npm install --save --legacy-peer-deps
over 4 years ago · Santiago Trujillo Report

0

I just update my Node.js and it works for me:

node -v

Output:

V xxxx

And:

sudo npm install -g n

(Use this command to install the stable node release.)

sudo n stable
over 4 years ago · Santiago Trujillo Report

0

Here is the solution.

Go to the project directory and do:

sudo rm ./package-lock.json
sudo npm install --force
over 4 years ago · Santiago Trujillo Report

0

In my case, I started getting the error (below) after upgrading npm from version 6 to 7.

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree

...

npm ERR! Fix the upstream dependency conflict, or retry this command with --force, or --legacy-peer-deps to accept an incorrect (and potentially broken) dependency resolution.

In my case compiling with either --legacy-peer-deps or --force flags resulted in a useless bundle.

So I tried deleting the node_modules, package-lock.json, and bundle using yarn install. This generated a yarn.lock file and created package-lock.json that worked fine in subsequent npm runs.

P.S.: I am using the temporary workaround until npm 7 works fine with my project: after that, I will delete yarn.lock, package-lock.json and folder node_modules, and recompile with npm

rm -rf node_modules
rm package-lock.json
yarn install
# Generates a yarn.lock file and a new package-lock.json

# Continue with npm
npm start
over 4 years ago · Santiago Trujillo Report

0

  1. If you have node_modules folder and package-lock.json file in your root directory then remove those:

    rm -r node_modules
    rm package-lock.json
    
  2. Then run commands:

    npm install --save --legacy-peer-deps
    npm audit fix --force
    
  3. Create .env file in the root directory and paste below code:

    SKIP_PREFLIGHT_CHECK=true
    
  4. Now, start your project:

    npm start
    
over 4 years ago · Santiago Trujillo Report

0

The fastest solution: npm install --legacy-peer-deps

Explanation:

In npm versions 3 through 6, peerDependencies were not automatically installed, and would raise a warning if an invalid version of the peer dependency was found in the tree. As of npm v7, peerDependencies are installed by default.

npm docs: peerDependencies

Your dependency contains some peerDependencies that conflict with the root project's dependency.

As it described in the npm ERR log.

over 4 years ago · Santiago Trujillo Report

0

npm audit fix --force

Worked for me

over 4 years ago · Santiago Trujillo Report

0

This is an issue of node version Some latest versions of the node could show errors like these.

https://github.com/nvm-sh/nvm I use NVM to manage Node versions on the system and use node 12 to get past this error

command to change version

nvm use 12
over 4 years ago · Santiago Trujillo Report

0

ERESOLVE unable to resolve dependency tree error then add in the last of any dependency installation --legacy-peer-deps

Like: I am installing the socket.io so, I add --legacy-peer-deps in the last

$ npm install @nestjs/platform-socket.io @types/socket.io --legacy-peer-deps

over 4 years ago · Santiago Trujillo Report

0

NPM can be used to install and manage versions of dependencies in your projects.

I had it the same issue on React versions in relation with npm version

npm error found types/react@16.14.20

So it might be package-versions that need to be installed based on your package.json

It gives errors in npm@7 version and cannot install node modules. If you will downgrade npm version to 6, those problems will become warnings and the problem will be resolved.

  • Try to prove this command: npm install -g npm@6

  • Check if version is already installed: npm --version

  • Remove and install node_modules package:

    a) Remove rm -rf node_modules

    b) Install: npm i

over 4 years ago · Santiago Trujillo Report

0

Finally, I found the answer. Try this command -

npm install --save --legacy-peer-deps
over 4 years ago · Santiago Trujillo Report

0

Try 2 options to resolve this issue option1 => delete node_modules and package_lock.json after run
npm cache clean --force after npm i --force option 2 => run npm install --save --legacy-peer-deps

over 4 years ago · Santiago Trujillo Report

0

The problem is related to a dependency conflict or broken dependency. You can proceed by accepting the incorrection of dependency by forcing an install.

Solution: Using command with --force.

Your command will be like npm install --force @your-npm-package.

Note: You can use yarn to install a dependency if it's available in to install with the yarn package manager.

over 4 years ago · Santiago Trujillo Report

0

Yarn has a feature for solving this. If you can, try to use it for installing the package.

over 4 years ago · Santiago Trujillo Report

0

Start with the npm i --legacy-peer-deps flag first, and then use the --force flag next.

over 4 years ago · Santiago Trujillo Report

0

Just in case, I did have similar behavior, when I tried either npm upgrade my current Angular 11.x based boilerplate from previous ng new or create new ng new abc based on Angular 12.x. I simply forgot to upgrade Angular CLI. So this npm install -g @angular/cli@latest solved my errors during ng new abc.

over 4 years ago · Santiago Trujillo Report

0

For those who are getting errors while installing Bootstrap Paginator or table next

npm install react-bootstrap-table2-paginator --save

or

npm install react-bootstrap-table-next --save

Solution: Add --legacy-peer-deps after the command like

  • npm install react-bootstrap-table2-paginator --save --legacy-peer-deps
  • npm install react-bootstrap-table-next --save --legacy-peer-deps
over 4 years ago · Santiago Trujillo Report

0

I have faced this issue many times. At last I found a solution:

npm install react-native-paper  --legacy-peer-deps
over 4 years ago · Santiago Trujillo Report

0

Even after uninstall/install NPM and CLI if still does not work then make sure you are inside the project folder. For example, you have created a root folder "myapplication". Now, you are running CLI command to create a brand new application under myapplication folder. After running command, you would get error like "ERESOLVE unable to resolve dependency tree". So, instead of running command on myapplication folder, go to new application folder inside myapplication folder and run/execute angular application. It would work fine.

over 4 years ago · Santiago Trujillo Report

0

this works for me npm install --save --legacy-peer-deps

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!