6

I've downloaded a Angular 5 / .NET 5 project, and normally when I run the command npm install, I don't have any problems.

But since yesterday when downloading a project and running this command I get this error:

C:\Users\ca\source\repos\CCM\angular\src>npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: CCM@4.7.1
npm ERR! Found: @angular/compiler@10.2.1
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"^10.2.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@">=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0" from codelyzer@5.2.2
npm ERR! node_modules/codelyzer
npm ERR!   dev codelyzer@"^5.1.2" 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
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See C:\Users\ca\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\ca\AppData\Local\npm-cache\_logs\2021-03-24T08_34_44_177Z-debug.log

Normally I don't have any problem with this command so I'm wondering if it's a problem with my setup or with the project.

I can submit the full report if requested.

underscore_d
  • 6,309
  • 3
  • 38
  • 64
Carsten Løvbo Andersen
  • 26,637
  • 10
  • 47
  • 77

2 Answers2

6

considering the line

npm ERR! peer @angular/compiler@">=2.3.1 <10.0.0 || >9.0.0-beta <10.0.0 || >9.1.0-beta <10.0.0 || >9.2.0-beta <10.0.0" from codelyzer@5.2.2

the error is from the codelyzer@5.2.2 dependencies, I found this closed issue on github which indicates that it is not really a problem
running npm install --legacy-peer-deps could solve it, for more information check this out.

Modar Na
  • 873
  • 7
  • 18
0

Found out that codelyzer is actually not needed for Angular 13 and newer, see Codelyzer requires Angular 9 instead of Angular 10.

Original answer before finding out:

As suggested in codelyzer GitHub issue mentioned in the other answer, upgrading codelyzer helped me:

  1. Upgrade codelyzer to version to "^6.0.0"
  2. Remove "package-lock.json"
  3. Remove node_modules folder
  4. npm install works now

I know it's an old question, but it happened to me having Angular 13 project working normally and then break. Not really sure why now, though.

LordMsz
  • 154
  • 3
  • 5