The developers at Ionic Framework are constantly releasing updates to both their CLI and base install. With great new features and fixes in every release, you’re going to find yourself wanting to upgrade frequently. But how does one do this? As of right now there is no magical all in one
ionic update command.
These are the steps to update your CLI and base library for a given project.
The first thing you probably want to do is make sure your CLI is up to date. Assuming you already have NPM and Ionic Framework installed, run the following command:
sudo npm install -g ionic
Now you Windows users might be wondering what the heck
sudo is. Well, the short answer is, this command is not for you. Instead you should try running without the
sudo is for Mac and Linux users.
After the CLI has been updated you have a few options when it comes to updating your base library install.
I recommend you download and install Bower as it is useful for this job as well as many others. If you choose the Bower route, you can run the recommended command from within your project root:
ionic lib update
I am old fashion, so when I update my Ionic project, I alter the bower.json file and then run
bower install to complete the update. As of CLI 1.1.8, you shouldn’t need to go that route.
If you don’t have Bower installed and don’t wish to install it, you should still be able to run
ionic lib update, but the process completes a little differently. I personally have not updated this way.
Since we are in the spirit of updating, we might as well update Apache Cordova as well. To update Apache Cordova, we will do pretty much what we did for the Ionic CLI update.
sudo npm install -g cordova
Just like that, everything should be up to date.