我在添加Android平台时得到以下错误。我检查了ant -version
,它正确地输出了。此外,我注意到当它创建myApp文件夹node_modules
时,它没有被获取。下面是控制台的输出:
Adding platform android
Creating android project...
C:Usersuser.cordovalibandroidcordova3.5.0binnode_modulesqq.js:126
throw e;
^
Error: An error occurred while listing Android targets
at C:Usersuser.cordovalibandroidcordova3.5.0binlibcheck_reqs.js
:87:29
at _rejected (C:Usersuser.cordovalibandroidcordova3.5.0binnode_m
odulesqq.js:808:24)
at C:Usersuser.cordovalibandroidcordova3.5.0binnode_modulesqq.
js:834:30
at Promise.when (C:Usersuser.cordovalibandroidcordova3.5.0binnod
e_modulesqq.js:1079:31)
at Promise.promise.promiseDispatch (C:UsersRiliwan.cordovalibandroidco
rdova3.5.0binnode_modulesqq.js:752:41)
at C:Usersuser.cordovalibandroidcordova3.5.0binnode_modulesqq.
js:574:44
at flush (C:Usersuser.cordovalibandroidcordova3.5.0binnode_modul
esqq.js:108:17)
at process._tickCallback (node.js:419:13)
Error: C:Usersuser.cordovalibandroidcordova3.5.0bincreate.bat: Comma
nd failed with exit code 8
at ChildProcess.whenDone (C:UsersRiliwanAppDataRoamingnpmnode_modules
cordovanode_modulescordova-libsrccordovasuperspawn.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.
我使用的是Ubuntu 14.04,并通过将这些路径设置为os路径来修复它:
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:.