安装 Ionic
Ionic 2 apps are created and developed primarily through the Ionic command line utility (the “CLI”), and use Cordova to build and deploy as a native app. This means we need to install a few utilities to get developing.
Ionic CLI 和 Cordova
To create Ionic 2 projects, you’ll need to install the latest version of the CLI and Cordova. Before you do that, you’ll need a recent version of Node.js.Download the installerfor Node.js 6 or greater and then proceed to install the Ionic CLI and Cordova for native app development:
$ npm install -g ionic cordova
You may need to add “sudo” in front of these commands to install the utilities globally
如果安装失败
uninstall
,再次安装
Once that’s done, create your first Ionic app:
$ ionic start cutePuppyPics --v2
Omit –v2 if you’d like to use Ionic 1. To run your app,cd
into the directory that was created and then run theionic serve
command to test your app right in the browser!
$ cd cutePuppyPics
$ ionic serve
平台向导
For those building native apps for iOS and Android (most of you!), each platform has certain features and installation requirements before you can get the most out of your Ionic and Cordova development.
For iOS developers, take a look at the Cordova iOS Platform Guide and follow the instructions to install or upgrade Xcode, and possibly register for a developer account to start building apps for iOS.
For Android developers, take a look at the Cordova Android Platform Guide and follow the instructions to install the SDK and/or Android Studio to start building apps for Android.