Upgrading to Ionic CLI 3 -- Words (621)

Ionic
How to upgrade 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/[email protected]
npm install --save-dev @ionic/[email protected]
One of the improvments to Ionic CLI v3 is the best assistance when you are using commands either with a new project or an old existing project ,so if you have old projects generated by previous versions of the Ionic CLI ,just go ahead and try to serve them and don't worry the CLI will detect the changes and prompt you to install the necessary dependencies .
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

ionic info 

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
You can also type just ionic start and let the CLI assists by asking you other info about the project you are creating and then generate one for you .
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

Conclusion


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 .



mrnerd is a Web Entrepreneur & Developer, Digital Marketer and a Passionate Blogger. He writes about software and website development,money making tips and SEO etc.. He is a tech addict and a computer geek with a lot of hobbies.