IONIC CLI could not add Platform Android

冷暖自知 提交于 2019-12-23 12:16:20

问题


I tried to add Android platform with 'ionic platform add android' and it gave the following error:

> C:\Users\---\Desktop\Tst\Test>ionic platform add android
>     Updated the hooks directory to have execute permissions
>     Downloading Default Ionic Resources
>     Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
>     [=============================]  100%  0.0s
>     Done adding default Ionic resources
>     Adding icons for platform: android
>     Error: Cannot find module 'config-chain'
>         at Function.Module._resolveFilename (module.js:337:15)
>         at Function.Module._load (module.js:287:25)
>         at Module.require (module.js:366:17)
>         at require (module.js:385:17)
>         at Object.<anonymous> (C:\Users\---\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\node_modules\npmconf\npmconf.js:2:10)
>         at Module._compile (module.js:435:26)
>         at Object.Module._extensions..js (module.js:442:10)
>         at Module.load (module.js:356:32)
>         at Function.Module._load (module.js:311:12)
>         at Module.require (module.js:366:17)
>         at require (module.js:385:17)
>     
>     C:\Users\---\Desktop\Tst\Test>

What is wrong with it ?


回答1:


I think your cordova npm package has been missed some modules. Try this to re-install it:

npm uninstall cordova -g && npm install -g cordova

I'm using version 5.0 and it works fine, if above not works, try this:

npm uninstall cordova -g && npm install -g cordova@5.0


来源:https://stackoverflow.com/questions/33384345/ionic-cli-could-not-add-platform-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!