在Windows中安装PhoneGap 3.6.3错误

时间:2014-10-01 17:37:13

标签: javascript android cordova

有人能帮助我吗?

在我的项目上安装android平台时出现以下错误。

这是我第一次使用新版本的phonegap。

有人可以帮助我吗?

C:\example>cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.6.3
npm http 200 https://registry.npmjs.org/cordova-android/3.6.3
npm http GET https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.
tgz
npm http 200 https://registry.npmjs.org/cordova-android/-/cordova-android-3.6.3.
tgz
Creating android project...

C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\node_mod
ules\q\q.js:126
                    throw e;
                          ^
Error: ANDROID_HOME is not set and "android" command not in your PATH. You must
fulfill at least one of these conditions.
    at C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\l
ib\check_reqs.js:158:19
    at _fulfilled (C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\p
ackage\bin\node_modules\q\q.js:798:54)
    at self.promiseDispatch.done (C:\Users\dario\.cordova\lib\npm_cache\cordova-
android\3.6.3\package\bin\node_modules\q\q.js:827:30)
    at Promise.promise.promiseDispatch (C:\Users\dario\.cordova\lib\npm_cache\co
rdova-android\3.6.3\package\bin\node_modules\q\q.js:760:13)
    at C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\n
ode_modules\q\q.js:821:14
    at flush (C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\packag
e\bin\node_modules\q\q.js:108:17)
    at process._tickCallback (node.js:419:13)
    at Function.Module.runMain (module.js:499:11)
    at startup (node.js:119:16)
    at node.js:906:3
Error: C:\Users\dario\.cordova\lib\npm_cache\cordova-android\3.6.3\package\bin\c
reate.bat: Command failed with exit code 8
    at ChildProcess.whenDone (C:\Users\dario\AppData\Roaming\npm\node_modules\co
rdova\node_modules\cordova-lib\src\cordova\superspawn.js:135:23)
    at ChildProcess.emit (events.js:98:17)
    at maybeClose (child_process.js:756:16)
    at Process.ChildProcess._handle.onexit (child_process.js:823:5)

1 个答案:

答案 0 :(得分:1)

如果您没有先安装Android SDK,则无法将Android添加为平台。

  

错误:未设置ANDROID_HOME且“PAT”中没有“android”命令。   您必须至少满足其中一个条件。

安装Android SDK后,您需要为Android SDK设置环境变量。 寻找“\ sdk \ tool”和“\ sdk \ platform-tools”。

在我的情况下,我把它放在Eclipse文件夹下,因为我安装了包含Android SDK的Eclipse ADT。