How to solve the errors with NPM Install?

Viewed 35

I am getting the below errors while doing the npm install but if i do npm install --force? everything works fine in the local environment but not during the repository build as my .yaml file script has the "npm install" Can someone help me on how to fix these issues?

I have tried the below two options but not helped to resolve issue

  1. npm audit fix --force
  2. npm install --legacy-peer-deps

screenshot of the error log

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR! 
npm ERR! While resolving: @angular/localize@10.0.14
npm ERR! Found: @angular/compiler@10.2.3
npm ERR! node_modules/@angular/compiler
npm ERR!   @angular/compiler@"^10.2.3" from the root project
npm ERR!   peer @angular/compiler@"10.2.3" from @angular/compiler-cli@10.2.3
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"^10.2.3" from the root project
npm ERR!     peer @angular/compiler-cli@"^10.0.0" from @angular-devkit/build-angular@0.1002.3
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"^0.1002.3" from the root project
npm ERR!     1 more (@ngtools/webpack)
npm ERR!   1 more (@angular/platform-browser-dynamic)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"10.0.14" from @angular/localize@10.0.14
npm ERR! node_modules/@angular/localize
npm ERR!   @angular/localize@"^10.0.14" from the root project
npm ERR!   peerOptional @angular/localize@"^10.0.0" from @angular-devkit/build-angular@0.1002.3
npm ERR!   node_modules/@angular-devkit/build-angular
npm ERR!     dev @angular-devkit/build-angular@"^0.1002.3" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/compiler@10.0.14
npm ERR! node_modules/@angular/compiler
npm ERR!   peer @angular/compiler@"10.0.14" from @angular/localize@10.0.14
npm ERR!   node_modules/@angular/localize
npm ERR!     @angular/localize@"^10.0.14" from the root project
npm ERR!     peerOptional @angular/localize@"^10.0.0" from @angular-devkit/build-angular@0.1002.3
npm ERR!     node_modules/@angular-devkit/build-angular
npm ERR!       dev @angular-devkit/build-angular@"^0.1002.3" 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.
1 Answers
  • Try to remove the package-lock file & your node_modules folder
  • and re-run the command npm install --legacy-peer-deps

it should be fine

Related