Ionic CLI
Ionic CLI is the primary tool used during the process of developing an Ionic app. It’s like a Swiss Army Knife, that brings together a bunch of miscellaneous tools under a single interface. The CLI contains a number of commands crucial for Ionic development, such as Start, Build, Serve, and Run. It also contains commands like emulate and info, which can be helpful in certain situations.
Installing the CLI
To install the CLI, you need to install node and npm first.
Note - The CLI requires Node 4.X (Node 5.X is known to cause a number of issues).
Once installed, run the following command to get the latest version of the Ionic CLI.
$ npm install -g ionic
On Mac and Linux, you’ll need to add sudo to install Ionic globally.
$ sudo npm install -g ionic
Basic Usage
One of the most important commands is the start command which creates a new Ionic project. Let’s try it out.
$ ionic start myAwesomeApp --v2
This will create a new app named myAwesomeApp. Let’s cd into that directory, and run another Ionic CLI command.
$ ionic info
This should print out details about your Ionic environment which is useful for debugging. Finally, to view your app in the browser, you can use the Serve command.
$ ionic serve