36

When i try to do npm install i get the following:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   zone.js@"~0.8.26" from the root project
npm ERR!   peer zone.js@"~0.8.26" from @angular/[email protected]
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/core@"~7.2.0" from the root project
npm ERR!     peer @angular/core@"^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0" from [email protected]
npm ERR!     node_modules/primeng_latest
npm ERR!       primeng_latest@"npm:primeng@^11.2.0" from the root project
npm ERR!     3 more (@angular/common, @angular/forms, @angular/platform-browser)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer zone.js@"^0.10.2" from [email protected]
npm ERR! node_modules/primeng_latest
npm ERR!   primeng_latest@"npm:primeng@^11.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

This is my package.json dependencies file:

  "dependencies": 
    "@angular/compiler": "~7.2.0",
    "@angular/core": "~7.2.0",
    "@angular/forms": "~7.2.0",
    "@angular/http": "^7.2.4",
    "@angular/material": "^7.3.7",
    "@angular/router": "~7.2.0",
    "@types/d3": "^5.7.2",
    "bootstrap": "^4.4.1",
    "codemirror": "^5.58.2",
    "file-saver": "^2.0.0",
    "font-awesome": "^4.7.0",
    "highcharts": "^9.0.0",
    "material-design-icons": "^3.0.1",
    "moment": "^2.24.0",
    "ngx-spinner": "^7.2.0",
    "ngx-toastr": "^9.2.0",
    "primeicons": "^1.0.0",
    "primeng": "^7.0.5",
    "primeng_latest": "npm:primeng@^11.2.0",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"

I tried downgrading the versions but it still gives the error. I also tried to google the solution but didn't find the right solution, would appreciate any help, Thank you.

3
  • "devDependencies": "@angular-builders/custom-webpack": "^7.4.3", "@angular-builders/dev-server": "~7.3.1", "@angular-devkit/build-angular": "^0.13.2", "@angular-devkit/build-ng-packagr": "~0.13.0", "@angular-devkit/core": "^11.0.1", "@angular/compiler-cli": "~7.2.0", "ng-packagr": "^4.2.0", "primeng": "^6.1.7", "ts-node": "~7.0.0", "tsickle": ">=0.34.0", "tslib": "^1.9.0", "tslint": "~5.11.0", "typescript": "~3.2.2", "webpack-dev-server": "^3.11.2" Commented Feb 22, 2021 at 18:26
  • 2
    You have package-lock.json file try following command: npm ci, If it still fails delete package-lock.json and node_modules folder and then try npm i command. Commented Feb 22, 2021 at 19:02
  • Thanks Rohit Dalal, but it didnt work, getting the same error. Commented Feb 23, 2021 at 5:08

5 Answers 5

109

Looks like it's a problem with Peer Dependencies try with npm install --legacy-peer-deps.

Sign up to request clarification or add additional context in comments.

6 Comments

Thank You! Solved npm install @formkit/auto-animate install issue.
I ran this and went from 1 error to 45 errors
@Markus please tell the rest of us how you solved those, thanks
iirc it was a matter of deleting the node modules folder and making sure all versions in package.json lined up with the versions that the dependencies expected
using --legacy-peer-deps or --force should be considered a temporary solution to bypass strict dependency resolution. Instead, I followed these steps: <br/> npm cache clean --force # Clean npm cache <br/> rm -rf node_modules package-lock.json # Remove existing dependencies and lock file <br/> npm install # Reinstall all dependencies
|
37

You can skip peer dependency conflict checks by running npm install --legacy-peer-deps or you can set npm config set legacy-peer-deps true and then run npm install once again.

Comments

2

If you want to run the angular code of your friend in your machine then follow the steps.

step 1: this can be happen due to version mismatch in your node version and your friends node version and npm version. C://projectFolder> node --version then C://projectFolder> npm -v

step 2: If the version is mismatch then uninstall node in your machine then restart then install the node version of your friend.

step 3: run the below code example

1.

npm install npm@[version]

in my machine

npm install -g [email protected]
  1. now run npm install in your project folder

    npm install

  2. now npm start or ng serve to work perfectly

1 Comment

to quickly switch between node versions on your machine (back and forth), consider installing nvm
0

in your case, the library primeng_latest has a peer dependency zone.js but expects it to be version 0.10.2 or above ( 0.10+ ) and your root version of that dependency is 0.8.29 (which is lower)

One solution is to update your root zone.js to ^0.10.2 instead of your current ~0.8.26.

This should fix this particular issue because all other peer dependencies would tolerate the change in version:

npm install zone.js@^0.10.2

Comments

0

If your using Mac Os, run the command as administrator with sudo.

sudo npm install --legacy-peer-deps

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.