Reputation: 178
I'm trying to update my Angular project. I have done this already multiple times in the past and it worked well. But from version 10.2 to 11.0 I get this error right when running the first update command from the guide (update.angular.io):
ng update @angular/core@11 @angular/cli@11
And this is the error:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! Found: @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1102.14" from the root project
npm ERR! peer @angular-devkit/build-angular@">=0.900.0" from [email protected]
npm ERR! node_modules/ngx-build-plus
npm ERR! dev ngx-build-plus@"^10.1.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"~0.1102.14" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/compiler-cli
npm ERR! peer @angular/compiler-cli@"^11.0.0 || ^11.2.0-next" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"~0.1102.14" 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 /Users/michael/.npm/eresolve-report.txt for a full report.
Has anyone experienced this error and knows how to handle it? I'm unfortunately a bit helpless.
Upvotes: 0
Views: 1466
Reputation: 178
npm install --legacy-peer-deps
right after the posted error message was what did the trick. It helped me to continue my Angular update from 10.2 to 11, and then to 12.
The project has no problems afterwards.
Upvotes: 4
Reputation: 723
For me the problem was that the code editor was open.
On closing the editor and running ng update @angular/core @angular/cli
angular successfully updated
Otherwise , try below :
* Delete node_modules and package-lock.json
* npm cache clean --force
* npm i --force
Upvotes: 2