6

What is the proper set of npm commands to update Ionic from v5.0 to v5.3.1 (latest release), as well as, bump the version of Capacitor, Ionic Native, and the dev dependencies appropriately?

I can't find an update guide with commands in the Ionic docs unlike in Angular where you would follow the update steps on https://update.angular.io. They don't seem to indicate whether the CLI version should match the Ionic version, or whether the version of Capacitor for a specific version of Ionic or the CLI is required, or if none of that matters.

Would I run these commands:

// dependencies
npm install @capacitor/android@latest
npm install @capacitor/core@latest
npm install @capacitor/ios@latest
npm install @ionic/core@latest
npm install @ionic-native/core@latest
npm install @ionic-native/in-app-browser@latest
npm install @ionic-native/splash-screen@latest
npm install @ionic-native/status-bar@latest
npm install @ionic/angular@latest
npm install @ionic/storage@latest
// dev dependencies
npm install @capacitor/cli@latest
npm install @ionic/angular-toolkit@latest
npm install @ionic/lab@latest

or equivalently just run npm upgrade <LIST_OF_ABOVE_PKGS>? and are there dependencies between Ionic, Ionic CLI, Capacitor, and Ionic Native?

mtpultz
  • 17,267
  • 22
  • 122
  • 201
  • 3
    Unfortunately, yes, there is no upgrade command. The main problem is, that ionic is not compatible with all versions of typescript, zone and rxjs. As reference i use https://github.com/ionic-team/starters/blob/master/angular/base/package.json of the ionic angular starter. In addition I use npm-check-updates to identify other packages an available versions for the other packages. – Sven 31415 Aug 06 '20 at 19:08
  • That's a really good suggestion to version off the angular starter template to keep ionic, ionic cli, ionic native, and capacitor; at known versions that work together. Thanks! – mtpultz Aug 07 '20 at 00:17
  • 3
    I'm following this question since I hope one day they'll add a new console command to update Ionic & Angular. In the meanwhile I'd like to share my method. The `package.json` of the starter is an interesting way, but since the Ionic team usually adds something new also in other files from a major to another, I usually generate a new project aside the project I want to update. Then I copy all of my code and install all the extra packages from the old project to the new one. Keep an eye for any breaking change in Angular version since this method forces you to manually adapt your code if needed – Deadpool Aug 07 '20 at 13:39

1 Answers1

0

run at cmd in "npm install -g ionic@5.3.2"

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 28 '22 at 04:45