Having difficulty upgrading from Ionic 5 to Ionic 6 (dependency issues)

When I try to update to Ionic 6 using the command:

npm install @ionic/angular@6

I get this:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: Project@0.0.2
npm ERR! Found: @angular/core@8.1.3
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~8.1.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/core@">=12.0.0" from @ionic/angular@6.3.0
npm ERR! node_modules/@ionic/angular
npm ERR!   @ionic/angular@"6" 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 /x/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /x/.npm/_logs/2022-10-11T23_20_13_132Z-debug.log

Which means my angular core is out of date, so I try to update my angular core using this command:

npm i @angular/core@"~12.x.x"

I get

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: Project@0.0.2
npm ERR! Found: zone.js@0.9.1
npm ERR! node_modules/zone.js
npm ERR!   zone.js@"~0.9.1" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer zone.js@"~0.11.4" from @angular/core@12.2.16
npm ERR! node_modules/@angular/core
npm ERR!   @angular/core@"~12.x.x" from the root project

What am I doing wrong? How can I fix this?

Any help would be appreciated.

You need to upgrade Angular dependencies first. Follow the Angular Update Guide, then update Ionic.

1 Like