1
Cordova正確安裝,Android SDK也是如此。'ANDROID_HOME'環境變量在linux上與nodejs未定義由cordova
# echo $ANDROID_HOME
/home/user/android-sdk-linux
但
# cordova build android --verbose
Error: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
Failed to find 'android' command in your 'PATH'. Try update your 'PATH' to include path to valid SDK directory.
at /home/user/myApp/platforms/android/cordova/lib/check_reqs.js:225:8
at _fulfilled (/home/user/myApp/platforms/android/cordova/node_modules/q/q.js:834:54)
at self.promiseDispatch.done (/home/user/myApp/platforms/android/cordova/node_modules/q/q.js:863:30)
at Promise.promise.promiseDispatch (/home/user/myApp/platforms/android/cordova/node_modules/q/q.js:796:13)
at /home/user/myApp/platforms/android/cordova/node_modules/q/q.js:857:14
at runSingle (/home/user/myApp/platforms/android/cordova/node_modules/q/q.js:137:13)
at flush (/home/user/myApp/platforms/android/cordova/node_modules/q/q.js:125:13)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
好吧......通過檢查的NodeJS變量:
# node
> process.env['ANDROID_HOME']
'~/android-sdk-linux'
一切似乎都很好... 好吧......編輯文件「家庭/用戶/對myApp /platforms/android/cordova/lib/check_reqs.js「(從上面的錯誤中)加入下一行:
if (!process.env['ANDROID_HOME']) {
console.log(process.env['ANDROID_HOME']);
throw new CordovaError('Failed to find \'ANDROID_HOME\' environment variable. Try setting setting it manually.\n' +
'Failed to find \'android\' command in your \'PATH\'. Try update your \'PATH\' to include path to valid SDK directory.');
}
結果是:
# cordova build android --verbose
Executing "before_build" hook for all plugins.
...
Executing "after_prepare" hook for all plugins.
Executing "before_compile" hook for all plugins.
**undefined**
Error: CordovaError: Failed to find 'ANDROID_HOME' environment variable. Try setting setting it manually.
如何與和的NodeJS科爾多瓦解決這個問題?
這就是所有完成的,問題的NodeJS! 系統中定義的ANDROID_HOME變量,但不能用js文件讀取。 – user1356144