Search code examples
angularangular-clinpm-installng-upgrade

ng update @angular/cli @angular/core or npx @angular/cli@13 update @angular/core@13 @angular/cli@13 is not working


I am trying to upgrade my angular cli and angular core from 12 to 13, but looks like there are peer dependency issues. did any one faced this issue ?

npx @angular/cli@13 update @angular/core@13 @angular/cli@13

[![npm ERR! Could not resolve dependency:
npm ERR! dev @angular/compiler-cli@"~13.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/typescript
npm ERR!   peer typescript@">=4.4.2 <4.5" from @angular/[email protected]
npm ERR!   node_modules/@angular/compiler-cli
npm ERR!     dev @angular/compiler-cli@"~13.0.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.][1]][1]
 

logs


Solution

  • I had the same issue whenever I upgraded my Angular app to higher version. I always used --force command, and upgrade finished successfully. So just add --force command, and be sure to test you app after the upgrade.

    npx @angular/cli@13 update @angular/core@13 @angular/cli@13 --force
    

    Also, do the same thing if you upgrading Material:

    npx @angular/cli@13 update @angular/material@13 --force