[Fixed] Npm Install is Failing (Could not resolve dependency)

Issue

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!   [email protected]"~0.8.26" from the root project
npm ERR!   peer [email protected]"~0.8.26" from @angular/[email protected]
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/[email protected]"~7.2.0" from the root project
npm ERR!     peer @angular/[email protected]"^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!       [email protected]"npm:[email protected]^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 [email protected]"^0.10.2" from [email protected]
npm ERR! node_modules/primeng_latest
npm ERR!   [email protected]"npm:[email protected]^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

**Please suggest a solution to resolve this error, Thank you in advance.**

**Dependencies in Package.json**
  "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:[email protected]^11.2.0",
    "rxjs": "~6.3.3",
    "zone.js": "~0.8.26"
  

I have only 3 months experience in angular, I tried downgrading the versions but it still gave error also tried to google the solution but didnt find the right solution, would appreciate any help, Thank you.

Solution

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

Leave a Reply

(*) Required, Your email will not be published