Upgrading to Ionic CLI 3
If you've done it yet ,you should upgrate to version 3 of Ionic CLI which contains many changes and improvements such as the install speed ,better help documentation and interactive commands so if you usually forget how to use the commands ,the new CLI will help you use them .
This upgrade will change the way you use the CLI because some commands have been removed and some other commands have been changed ,but it's really worth it .
So to get started ,open you command prompt or terminal and type :
npm uninstall -g ionic
This will uninstall the current installed version of the Ionic CLI .
Next run the following to install Ionic CLI v3
npm install -g [email protected]
You need also to install the new CLI inside your current project if you are working on a project generated with the previous CLI version
Inside an Ionic 1 project ,execute
npm install --save-dev @ionic/[email protected] npm install --save-dev @ionic/[email protected]
Inside an Ionic 2 / Ionic 3 ,execute
npm install --save-dev @ionic/cli-plugin-ionic-angular@latest npm install --save-dev @ionic/[email protected]
For example if you run ionic serve with an old existing project ,the CLI will propts you to install @ionic/cli-plugin-ionic-angular and you just have to answer YES .Also when you need to use ionic cordova command ,the CLI will prompt you to install @ionic/cli-plugin-cordova plugin .
After installing the Ionic CLI v3 ,you can verify the versions of installed components by running
I'm getting :
global packages: @ionic/cli-utils : 1.0.0 Ionic CLI : 3.0.0 System: Node : v7.9.0 OS : Linux 4.2 Xcode : not installed ios-deploy : not installed ios-sim : not installed
Generating a new project with Ionic CLI v3
Lets use the new CLI to generate a new Ionic project .GO ahead and run
ionic start hellocli3 blank
When the CLI finishes ,navigate inside the project and run ionic info
cd hellocli3 ionic info
You should get something like
global packages: @ionic/cli-utils : 1.0.0 Cordova CLI : 6.5.0 Ionic CLI : 3.0.0 local packages: @ionic/app-scripts : 1.3.7 @ionic/cli-plugin-cordova : 1.0.0 @ionic/cli-plugin-ionic-angular : 1.0.0 Ionic Framework : ionic-angular 3.2.1 System: Node : v7.9.0 OS : Linux 4.2 Xcode : not installed ios-deploy : not installed ios-sim : not installed
As you can see ,you don't need to specify the old switch --v2 anymore
You can also watch this video from Paul Halliday on Youtube
The Ionic CLI is getting better and smarter ,it also changes a little bit ,the way we are used to create projects and build them so it's wise to upgrate now and start using and getting familiar with new CLI to get benefits from the new improvements .
- Author: Ahmed Bouchefra Follow @ahmedbouchefra