Monday, March 27, 2017

The first thing you probably want to do is make sure Ionic-CLI and Cordova are up to date:

1

npm install-g cordova ionic@beta

This line will also install both frameworks from scratch if you don’t have previous installations.

For the next step, you need to be inside a project folder.

UPDATE IONIC 2 PROJECT

Warning: Backup your project before you do this next step.

I bet a lot of you have a previous experience with Ionic v1. Back then, Ionic v1 was updated using this line:

1

ionic lib update

This solution no longer works. Ionic v1 used bower under the hood; Ionic v2 is moving away from this approach.

New solution requires us to know current Ionic v2 version. To find this information, open an official Ionic Framework npm page, look at the right side, you’ll find it there:

This value should be a current Ionic 2 Framework version.

Let’s get back to our local project. Find a local version of package.json, search for a dependencies section, and update ionic-framework parameter value.

If Ionic 2 is still in alpha status, prior to doing next step, you may want to remove the ionic-framework folder from node_modules folder.

Update your project using this line:

1

npm install

While manually updating Ionic 2 settings, you can’t know if a newly updated version also requires additional/new dependencies. If any dependency changed since the last installation, you’d receive an error looking like this: