How to update ionic 4 project to latest beta release?

I updated ionic globally to v4 beta.3 a week ago and created a new project. How can I update my project to beta.5? I ran

npm install -g ionic@latest as well as npm install --save ionic@latest but when I opened my package.json in my project it doesn’t look like anything changed. I’m sure this is a stupid question but I’m lost and hoping someone can point me in the right direction when it comes to updating my project the same way as creating a new one with ionic start.

Thanks!

1 Like

First way, with cmd, like:

 npm rm @ionic/angular --save
 npm install @ionic/angular --save

Second way, the “clean sheet” way:

edit manually package.json and change the version according what you want, like changing 4.0.0-beta.3 to 4.0.0-beta.5

then

 rm -r node_modules
 rm package-lock.json
 npm install

conz: it wipe all libs and will recreate a new lock file, so in the meantime you could receive other dependencies update
pro: it makes every dependencies clean again

I use this method these days with beta because then I’m sure I’m up-to-date and won’t discover later some weird issue with a dependencies, but well like I said, there are some conz

Alternative: use ncu (https://github.com/tjunnone/npm-check-updates). In any case actually, I love ncu, it really helps me each week to follow updates or at least to see which of the dependencies I used moved

important note if you want to upgrade to beta.5 from beta.3, note that you should also check if you are using typescript v2.9.2 and angular >= 6.1, if not they should be upgraded too

I hope it helps

9 Likes

I use two other methods to update Ionic (Angular) that may help:

  1. Angular Cli
    Use Angular CLI to update Angular dependencies.
    Juste type $ ng update and follow instructions
  2. Ionic Conference App
    Check Ionic Conference App Demo package.json
    https://github.com/ionic-team/ionic-conference-app/blob/master/package.json
    This App is updated regurarly by the Ionic team in order to follow releases.
    Copy dependencies versions and paste it un your project package.json.
    Then run $ npm install, if something fails during update (which generally does), just delete /node_modules folder and run $ npm install again.
1 Like

Another npm-check-updates-based method:

npm i -g npm-check-updates
npm-check-updates -u
npm install

Use at your own risk!

1 Like