If you’re reading this article to learn how to update your Ionic 2 application project, let me tell you one thing, your pain is my pain.
 
Every new Ionic Framework version brings us a treasure trove of new features, bug fixes and enhancements. Which is great, but what can we do to upgrade our existing project(s)?
 
Unfortunately, Ionic 2 can make this process a little bit cumbersome so let me show you what to do.
 
 

Note: If this tutorial was helpful, need further clarification, something is not working or do you have a request for another Ionic post? Furthermore, if you don't like something about this blog, if something is bugging you, don't like how I'm doing stuff here, again leave me a comment below. I'm here to help you, I expect the same from you. Feel free to comment below, subscribe to my blog, mail me to dragan.gaic@gmail.com, or follow and mention me on twitter (@gajotres). Thanks and have a nice day!

PS. If you want my help, if possible (even if it takes you some time to do that), create a working example I can play with. Use Plunker for AngularJS based questions or jsFiddle for jQuery/jQuery Mobile based questions.


 

Table of Contents

 
The Ionic 2 is a complex and sometimes difficult framework and this article will hardly satisfy all your needs. If you require more information beyond the subject of this article you will probably find it in a list below. Take a look; if there’s a topic not covered there, leave me a comment and I’ll cover it.
 
 

Update Ionic-CLI and Cordova

 
The first thing you probably want to do is make sure Ionic-CLI and Cordova are up to date:
 
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:
 
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:
 
Ionic 2 npm page
 
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:
 
npm install
 
Now comes the funny part.
 
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:
 
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.3
npm ERR! npm  v2.14.7
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package angular2@2.0.0-alpha.52 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer ionic-framework@2.0.0-alpha.49 wants angular2@2.0.0-beta.0

npm ERR! Please include the following file with any support request:
npm ERR!     E:\Programiranje\Ionic2\Ionic2FirstApp\npm-debug.log
 
As you can see, my current Ionic 2 version requires newer Angular2 version; update package.json accordingly.
 
Do this step over and over until you find a stable combination.
 
Finally, let’s check if everything is working as it should:
 
ionic serve
 

Conclusion

 
I know this is not a perfect solution, but, for now, it works. I’ll update this article once I find a better or easier solution.
 

Who Am I?

Between working as a senior Java developer in one of the largest insurance companies in the world and traveling, in my free time, I work as a professional mobile development adviser. I'm also a major jQuery Mobile supporter back at StackOverflow and a forum moderator at the official Ionic Framework forum.

Blogs worth reading

If you're here looking for information related to the Ionic Framework, you will also like these blogs:






  • Fedor Usakov

    But how can I upgrade Angular only? Is there a way to do this?

  • 7200rpm

    Yeah I’m going through this updating mess right now. Would be nice to update the version for ionic 2 and force updating of any dependencies…

  • Rakesh Ojha

    all the topics are not opening .. url not found error