ionic-frameworkcapacitorcapacitor-plugin

Migrate from capacitor 5 to 6


I'm trying to upgrade capacitor from 5 to 6, following this guide

https://capacitorjs.com/docs/updating/6-0#using-the-cli-to-migrate

But when I do, I have :

✖ Installing Latest Modules using npm. - failed!
[error] npm install failed. Try deleting node_modules folder and running npm install --force manually.
[error] Unable to find AppIcon-512@2x.png. Try updating it manually
✔ Update App Icon to only 1024 x 1024 in 391.79μs
✔ Remove Podfile.lock from iOS .gitignore in 331.92μs
✔ Migrating build.gradle file. in 6.71ms
✔ Remove android.enableJetifier=true from gradle.properties in 363.96μs
[error] Found namespace in build.gradle already, skipping migration
✔ Migrating package from Manifest to build.gradle in 460.83μs
✔ Migrating gradle-wrapper.properties by updating gradle version to 8.0.2. in 479.67μs
✔ Migrating variables.gradle file. in 2.82ms
[warn] Skipped migrating package from Manifest to build.gradle in Capacitor plugins
[warn] Skipped Running cap sync.
[warn] Skipped upgrading gradle wrapper files
✔ Writing breaking changes. in 125.63μs
[warn] Migration to Capacitor ^5.0.0 is incomplete. Check the log messages for more information.

Solution

  • Looks like you skipped the first step where you install latest Capacitor CLI, and instead you are still running version 5.x, so it shows weird messages since you are updating from 5 to 5 and all the things were already changed when you upgraded from 4 to 5.

    Run npm i -D @capacitor/cli@latest and run npx cap migrate again and make sure it’s telling you that it’s updating to Capacitor 6.