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 ionic@latest
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.
- For iOS development, see the iOS Platform Guide.
- For Android development, see the Android Platform Guide.
Ionic Appflow
Ionic Appflow is a powerful suite of tools and services designed for the entire app lifecycle, all in one integrated experience. Ionic Appflow is fully supported in the Ionic CLI. See the Appflow Docs to get started.
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 printDEBUG
messages.