9

Can't find any info on Ionic 2 website. For example, a project is created with Ionic library 2.0.1. How do I update it to Ionic library 2.1.0? What is the standard procedure? ionic lib update is deprecated.

Shawn
  • 2,675
  • 3
  • 25
  • 48

2 Answers2

15

If you want to update your CLI, you need to run:

npm install -g ionic@latest

For updating your project, open your package.json and update the version of ionic-angular entry and any other dependencies that need to be updated. Reference to a package.json is here which is the one that is downloaded when you start a new project.

Then delete your projects node_modules and run:

npm install in your project directory.

Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
  • 1
    Instead of deleting `node_modules` folder manually, can I do `npm update` or `npm uninstall` + `npm install`? – Shawn Mar 04 '17 at 22:20
  • 2
    You could. But by experience I have found it causing some error or the other. – Suraj Rao Mar 05 '17 at 02:44
  • the question is the reference itself is outdated when you run `npm outdated`, so how to update to the latest version specified in `npm outdated`? – primee Jan 15 '18 at 13:10
4

You can also go to your project directory and type:

  1. npm install ionic-angular@latest --save
  2. npm install @ionic/app-scripts@latest --save-dev

In my case, npm install -g ionic@latest installed globally the latest ionic but it didn't update the ionic version of my project. Only the above solution worked.

  • PS 1: I'm using ionic 3
  • PS 2: Delete the project's folder node_modules, in case of errors
Realdo Dias
  • 517
  • 5
  • 11