SolvedAngular GettingStarted "Unable to resolve dependency tree" error during NPM install of APM-Start

I am using the Angular: Getting Started Pluralsight lesson and I am attempting to run npm install on the APM-Start folder found in the repository. I am receiving this error message, not entirely sure what it means but I think it might indicate a mismatched version somewhere? I have some experience with npm in the past, though I've never been good at troubleshooting it.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: apm@0.0.0
npm ERR! Found: @angular/compiler@10.0.14
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"~10.0.4" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"10.2.4" from @angular/compiler-cli@10.2.4
npm ERR! node_modules/@angular/compiler-cli
npm ERR!   peer @angular/compiler-cli@">=10.0.0-next.0 < 11" from @angular-devkit/build-angular@0.1000.8
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR! 
npm ERR! 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.
npm ERR! 
npm ERR! See /Users/robert.anderson/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/robert.anderson/.npm/_logs/2021-01-05T18_17_06_138Z-debug.log

How would I resolve this issue?

24 Answers

✔️Accepted Answer

Did you see any errors after running npm install?

Did you run npm audit fix? Running the fix will cause a mismatch with your versions, so it should not be run.

Try this:

  1. Delete node_module folder and the package-lock.json file.
  2. Run npm cache verify to verify and clean up your npm.
  3. Run npm install again. (Do NOT run npm audit fix)
  4. Run npm start

Let me know if that resolves the issue.

Other Answers:

I haven't seen that error before.

Had you done anything else? Or installed anything else into that folder?

What version of node and npm do you have?

Reading this:

Suggests trying:

  • npm install --force
  • npm install --legacy-peer-deps

But I don't know why you would suddenly see this. The dependencies in the package.json file should all be compatible unless something else was installed to modify it.

If you want to continue with the course without having to install anything, try using stackblitz as per the instructions here:

Thank you for the additional information. I'll spend some more time on it today, trying it on several machines, and I'll update the code as needed.