在Windows上的离子框架中添加平台时出错

时间:2014-05-30 18:00:54

标签: cordova ant ionic-framework

我在添加android平台时遇到以下错误...我检查了我的ant -version并且输出正确。另外我注意到它创建myApp文件夹时,node_modules没有被提取。下面是从我的控制台输出

Adding platform android
Creating android project...

C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.js:126
                    throw e;
                          ^
Error: An error occurred while listing Android targets
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\lib\check_reqs.js
:87:29
    at _rejected (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_m
odules\q\q.js:808:24)
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.
js:834:30
    at Promise.when (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\nod
e_modules\q\q.js:1079:31)
    at Promise.promise.promiseDispatch (C:\Users\Riliwan\.cordova\lib\android\co
rdova\3.5.0\bin\node_modules\q\q.js:752:41)
    at C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modules\q\q.
js:574:44
    at flush (C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\node_modul
es\q\q.js:108:17)
    at process._tickCallback (node.js:419:13)
Error: C:\Users\user\.cordova\lib\android\cordova\3.5.0\bin\create.bat: Comma
nd failed with exit code 8
    at ChildProcess.whenDone (C:\Users\Riliwan\AppData\Roaming\npm\node_modules\
cordova\node_modules\cordova-lib\src\cordova\superspawn.js:131:23)
    at ChildProcess.EventEmitter.emit (events.js:98:17)
    at maybeClose (child_process.js:753:16)
    at Process.ChildProcess._handle.onexit (child_process.js:820:5)
Unable to add platform android. Please see console for more info.

1 个答案:

答案 0 :(得分:27)

我正在使用Ubuntu 14.04并通过将这些路径设置为O.S来修复它。路径:

export ANDROID_HOME=/home/coutinho/android-sdk 
export ANDROID_TOOLS=/home/coutinho/android-sdk/tools/  
export ANDROID_PLATFORM_TOOLS=/home/coutinho/android-sdk/platform-tools/

PATH=$PATH:$ANDROID_HOME:$ANDROID_TOOLS:$ANDROID_PLATFORM_TOOLS:.

然后它运作良好。