Ionic CLI

The Ionic Command Line Interface (CLI) is your go-to tool for developing Ionic apps. You can follow CLI development on Github.

Installation

Please make sure latest Node 6 LTS and NPM 3+ are installed.

Then, install the CLI globally (you may need sudo):

$ npm install -g [email protected]

You can verify your installation with the ionic --version command.

Getting Started

Start a new Ionic project using ionic start:

$ ionic start myNewProject

ionic start will prompt you to select a “starter”. We recommend using the tutorial starter for your first app. See Starter Templates for a full list.

After selecting a starter, the CLI will create a new app named myNewProject. Once you cd into your project’s directory, a few new commands become available to you, such as ionic serve:

$ cd ./myNewProject
$ ionic serve

While running ionic serve, changes you make to your app code will automatically refresh the browser. If you want to see your app on a device or emulator, you can use Cordova.

You can list available commands with the ionic --help command.

Using Cordova

Integrate Ionic with Cordova to bring native capabilities to your app.

$ npm install -g cordova
$ ionic cordova --help
$ ionic cordova run ios

The ionic cordova commands (aside from ionic cordova resources) wrap the Cordova CLI. You can read about the differences in each command’s --help page. To learn more about the commands, see the Cordova CLI Reference documentation.

Ionic Pro

Ionic Pro is a powerful suite of tools and services designed for the entire app lifecycle, all in one integrated experience. Ionic Pro is fully supported in the Ionic CLI. See the Pro Docs to get started.

Ionic Cloud (legacy) will be supported until its end-of-life on January 31st, 2018. Until then, you can switch between Ionic Cloud and Ionic Pro with ionic config set -g backend legacy and ionic config set -g backend pro. Unfortunately, you’ll need to re-authenticate with ionic login each time the backend mode is switched.

Troubleshooting

If you’re having trouble with the Ionic CLI, you can try the following:

  • Make sure you’re on the latest version of the CLI. Update with npm update -g ionic.
  • Try running commands with the --verbose flag, which will print DEBUG messages.

API

Native

General