【问题标题】:MSBUILD : cordova-build error : Error: cmd: Command failed with exit code ENOENTMSBUILD:cordova-build 错误:错误:cmd:命令失败,退出代码为 ENOENT
【发布时间】:2017-09-24 08:32:11
【问题描述】:

我的 Cordova 程序在浏览器中执行而没有构建错误。当我尝试通过调试构建将其发送到我的 Android 手机到设备 (F5) 时,我在输出窗口中收到此构建错误:

MSBUILD : cordova-build error : Error: cmd: Command failed with exit code ENOENT

从输出窗口到失败的消息是:

You have been opted out of telemetry. To change this, run: cordova telemetry on.
No scripts found for hook "before_compile".
ANDROID_HOME=C:\Program Files (x86)\Android\android-sdk
JAVA_HOME=C:\Program Files (x86)\Java\jdk1.8.0_131
Reading build config file: C:\Users\S50A\Documents\Visual Studio 2017\Projects\ClockJsAN\ClockJsAN\build.json
Running command: cmd "/s /c ""C:\Users\S50A\Documents\Visual Studio 2017\Projects\ClockJsAN\ClockJsAN\platforms\android\gradlew.bat" cdvBuildDebug -b "C:\Users\S50A\Documents\Visual Studio 2017\Projects\ClockJsAN\ClockJsAN\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true""
Command finished with error code ENOENT: cmd /s /c ""C:\Users\S50A\Documents\Visual Studio 2017\Projects\ClockJsAN\ClockJsAN\platforms\android\gradlew.bat" cdvBuildDebug -b "C:\Users\S50A\Documents\Visual Studio 2017\Projects\ClockJsAN\ClockJsAN\platforms\android\build.gradle" -Dorg.gradle.daemon=true -Pandroid.useDeprecatedNdk=true"
1>MSBUILD : cordova-build error : Error: cmd: Command failed with exit code ENOENT
1>Done building project "ClockJsAN.jsproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
========== Deploy: 0 succeeded, 0 failed, 0 skipped ==========

很清楚上面的哪个命令失败了,但我不清楚如何修复它。 ENOENT 似乎意味着找不到东西。

(即 cmd /s /c ... 产生了错误)。

我注意到我没有在 config.xml 中安装插件。这可能是它正在寻找的东西吗?我还注意到,当我尝试通过 config.xml 安装 Cordova 媒体插件时,我遇到了同样的错误。请指教...

【问题讨论】:

    标签: android visual-studio cordova visual-studio-cordova


    【解决方案1】:

    如果在创建新的空白 Cordova 应用程序时也发生这种情况,那么您的系统中的某些内容设置不正确。您应该始终添加到任何应用程序的唯一插件是 device 插件。

    按照本指南确保您已安装所有必需的工具: Configure the Visual Studio Tools for Apache Cordova

    确保您使用的是 Java、Node、Git 和其他工具的 x86 版本。我正在使用Node 4.8.4,这是来自 4 分支的最新版本。您还需要使用SDK Manager GUI 安装Android SDK。此工具不需要 Android Studio。

    如果一切都失败了,请修复您的 Visual Studio 安装和/或重新安装 Apache Cordova tools。

    【讨论】:

    • 感谢 andreszs 的建议,在全新安装后,我能够创建一个新的空白 Cordova 应用程序。我现在只使用 Visual Studio 中内置的默认工具和额外选项,用于我可以编码的 Apache Cordova 应用程序。 (我正在并排运行默认安装的 Android Studio,没有干扰)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-12-19
    相关资源
    最近更新 更多