cordova platform add android 国内慢

Cordova报错:

E:\study\cordova\eppdemo>cordova platform add ios
WARNING: Applications for platform ios can not be built on this OS - win32.
npm http GET https://registry.npmjs.org/cordova-ios
npm http GET https://registry.npmjs.org/cordova-ios
npm http GET https://registry.npmjs.org/cordova-ios
Unable to fetch platform ios: Error: connect ETIMEDOUT

解决方案:

   切换为国内npm源

    

http://npm.taobao.org/
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
安装nrm
E:\study\cordova\eppdemo>nrm ls

  npm ---- https://registry.npmjs.org/
* cnpm --- http://r.cnpmjs.org/
  taobao - http://registry.npm.taobao.org/
  edunpm - http://registry.enpmjs.org/
  eu ----- http://registry.npmjs.eu/
  au ----- http://registry.npmjs.org.au/
  sl ----- http://npm.strongloop.com/
  nj ----- https://registry.nodejitsu.com/
  pt ----- http://registry.npmjs.pt/


E:\study\cordova\eppdemo>nrm use taobao

   Registry has been set to: http://registry.npm.taobao.org/


E:\study\cordova\eppdemo>nrm ls

  npm ---- https://registry.npmjs.org/
  cnpm --- http://r.cnpmjs.org/
* taobao - http://registry.npm.taobao.org/
  edunpm - http://registry.enpmjs.org/
  eu ----- http://registry.npmjs.eu/
  au ----- http://registry.npmjs.org.au/
  sl ----- http://npm.strongloop.com/
  nj ----- https://registry.nodejitsu.com/
  pt ----- http://registry.npmjs.pt/

   成功:

E:\study\cordova\eppdemo>cordova platform add android
npm http GET http://registry.npm.taobao.org/cordova-android
npm http 200 http://registry.npm.taobao.org/cordova-android
npm http GET http://registry.npm.taobao.org/cordova-android
npm http 200 http://registry.npm.taobao.org/cordova-android
npm http GET http://registry.npm.taobao.org/cordova-android/download/cordova-android-4.0.2.tg
npm http 200 http://registry.npm.taobao.org/cordova-android/download/cordova-android-4.0.2.tg
Adding android project...
Creating Cordova project for the Android platform:
        Path: platforms\android
        Package: com.deppon.epp
        Name: HelloCordova
        Activity: MainActivity
        Android target: android-22
Copying template files...
Android 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
npm http GET http://registry.npm.taobao.org/cordova-plugin-whitelist
npm http 200 http://registry.npm.taobao.org/cordova-plugin-whitelist
npm http GET http://registry.npm.taobao.org/cordova-plugin-whitelist/download/cordova-plugin-
st-1.0.0.tgz
npm http 200 http://registry.npm.taobao.org/cordova-plugin-whitelist/download/cordova-plugin-
st-1.0.0.tgz
Installing "cordova-plugin-whitelist" for android

E:\study\cordova\eppdemo>npm install -g ionic

相关推荐