简体   繁体   English

使用Cordova构建Ionic APP时出错

[英]Error when building Ionic APP using Cordova

(node:16112) UnhandledPromiseRejectionWarning: CordovaError: Failed to run "javac -version", make sure that you have a JDK installed. (节点:16112)UnhandledPromiseRejectionWarning:CordovaError:无法运行“ javac -version”,请确保已安装JDK。 You can get it from: http://www.oracle.com/technetwork/java/javase/downloads . 您可以从以下网址获得它: http : //www.oracle.com/technetwork/java/javase/downloads Your JAVA_HOME is invalid: C:\\Program Files (x86)\\Java\\jre1.8.0_171 您的JAVA_HOME无效:C:\\ Program Files(x86)\\ Java \\ jre1.8.0_171

I checked my user environment variable and I have the variable JAVA_HOME and set to "C:\\Program Files (x86)\\Java\\jre1.8.0_171" 我检查了用户环境变量,并获得了变量JAVA_HOME并将其设置为“ C:\\ Program Files(x86)\\ Java \\ jre1.8.0_171”

I also have C:\\Program Files (x86)\\Java\\jre1.8.0_171 appended to the user environment variable PATH. 我还将C:\\ Program Files(x86)\\ Java \\ jre1.8.0_171附加到用户环境变量PATH。

make sure you have a JDK installed 确保您已安装JDK

This is the relevant part of this error message. 这是此错误消息的相关部分。 Your JAVA_HOME points to a Java Runtime Environment (JRE), not to a Java Development Kit (JDK). 您的JAVA_HOME指向Java运行时环境(JRE),而不是Java开发工具包(JDK)。

javac is the Java compilation command, which Cordova is attempting to execute in this case. javac是Java编译命令,在这种情况下,Cordova会尝试执行该命令。 However, javac is not shipped with the JRE as it is a development tool. 但是,JRE不附带javac ,因为它是开发工具。

You need to download and install a JDK and set JAVA_HOME to point to it 您需要下载并安装一个JDK并将JAVA_HOME为指向它

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM