一.先安装node
二.cordova安装,建demo
➜ ~ git:(master) ✗ sudo npm install -g cordova Password: /usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova [email protected] /usr/local/lib/node_modules/cordova ├── [email protected] ├── [email protected] ├── [email protected] ├── [email protected] ([email protected]) ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) ➜ ~ git:(master) ✗ cd Desktop ➜ Desktop git:(master) ✗ cordova create hello com.example.hello HelloWorld Creating a new cordova project. ➜ Desktop git:(master) ✗ cd hello ➜ hello git:(master) ✗ cordova platforms add ios Adding ios project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-ios/3.9.2/package/bin/create /Users/goyoo/Desktop/hello/platforms/ios com.example.hello HelloWorld --cli iOS project created with [email protected] Discovered plugin "cordova-plugin-whitelist" in config.xml. Installing to the project Fetching plugin "cordova-plugin-whitelist@1" via npm Installing "cordova-plugin-whitelist" for ios This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. ➜ hello git:(master) ✗ cordova platforms add android Adding android project... Running command: /Users/goyoo/.cordova/lib/npm_cache/cordova-android/4.1.1/package/bin/create /Users/goyoo/Desktop/hello/platforms/android com.example.hello HelloWorld --cli Creating Cordova project for the Android platform: Path: platforms/android Package: com.example.hello Name: HelloWorld Activity: MainActivity Android target: android-22 Copying template files... Android project created with [email protected] Installing "cordova-plugin-whitelist" for android This plugin is only applicable for versions of cordova-android greater than 4.0. If you have a previous platform version, you do *not* need this plugin since the whitelist will be built in. ➜ ~ git:(m