错误:cordova构建命令错误

时间:2015-12-30 12:16:42

标签: cordova

这个错误是什么意思?我尝试运行cordova build命令,这是显示的错误

C:\Users\Dan\alaya>cordova build
Running command: cmd "/s /c "C:\Users\Dan\alaya\platforms\android   \cordova \build.
bat""
ANDROID_HOME=C:\Users\Dan\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_40\bin
Running: C:\Users\Dan\alaya\platforms\android\gradlew cdvBuildDebug -b    C:\Users\
Dan\alaya\platforms\android\build.gradle -Dorg.gradle.daemon=true

ERROR: JAVA_HOME is set to an invalid directory: C:\Program Files (x86)\Java\jdk
1.8.0_40\bin

Please set the JAVA_HOME variable in your environment to match the
location of your Java installation.

C:\Users\Dan\alaya\platforms\android\cordova\node_modules\q\q.js:126
               throw e;
                ^
Error code 1 for command: cmd with args: /s /c "C:\Users\Dan\alaya\platforms an
 droid\gradlew cdvBuildDebug -b C:\Users\Dan\alaya\platforms\android         \build.gradle
 Dorg.gradle.daemon=true"
 ERROR building one of the platforms: Error: cmd: Command failed  with \\exit  code
1
You may not have the required environment or OS to build this project
Error: cmd: Command failed with exit code 1

1 个答案:

答案 0 :(得分:0)

设置JAVA_HOME时出错。改变

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_40\bin

JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_40