I'm having trouble updating my Angular version. When I use ng update
I get the following output:
Name Version Command to update
----------------------------------------------------------------------------------------
@angular/cdk 12.1.2 -> 12.2.0 ng update @angular/cdk
@angular/cli 12.1.2 -> 12.2.0 ng update @angular/cli
@angular/core 12.1.2 -> 12.2.0 ng update @angular/core
@angular/material 12.1.2 -> 12.2.0 ng update @angular/material
Afterwards I try to update all four of them using the command:
ng update @angular/cdk @angular/cli @angular/core @angular/material -C
The package.json
is updated and afterwards npm i
is run in order to install all packages. Here I encounter the following 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@"^12.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! dev @angular-devkit/build-angular@"^12.2.0" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/localize
npm ERR! peerOptional @angular/localize@"^12.0.0 || ^12.2.0-next" from @angular-devkit/[email protected]
npm ERR! node_modules/@angular-devkit/build-angular
npm ERR! dev @angular-devkit/build-angular@"^12.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
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
I do not know why it says Found: @angular-devkit/[email protected]
when in the package.json
all @angular related files have ~12.2.0
declared as version.
Try with deleting node_modules
folder and package-lock.json
file and then reinstall npm
which might resolve your issue.
So, run the following commands:
remove node_modules
remove package-lock.json
npm install
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With