node.js 尝试构建 Cordova 应用程序时获取“spawn cmd ENOENT” (event.js:85)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28624686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:26:51  来源:igfitidea点击:

Get 'spawn cmd ENOENT' when try to build Cordova application (event.js:85)

node.jscordovacmdspawn

提问by valverde93

Get this error in windows cmd when I try to build (emulate) Cordova app.

当我尝试构建(模拟)Cordova 应用程序时,在 windows cmd 中出现此错误。

D:\dev\Cordova\toDoList>cordova build android

Running command: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat
events.js:85
  throw er; // Unhandled 'error' event
        ^
Error: spawn cmd ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1046:32)
at child_process.js:1137:20
at process._tickCallback (node.js:355:11)
ERROR building one of the platforms: Error: D:\dev\Cordova\toDoList\platforms\android\cordova\build.bat: Command failed with exit code 1
You may not have the required environment or OS to build this project

回答by valverde93

I checked system variables one more time and found the cause of the problem: missing C:\Windows\System32\variable. I added it and that solved my problem

我又检查了一次系统变量,找到了问题的原因:缺少C:\Windows\System32\变量。我添加了它,这解决了我的问题

Hope, it help you too.

希望对你也有帮助。

回答by Chetann

just add it to the PATH: C:\Windows\System32 and start cmd as Administrator

只需将其添加到 PATH:C:\Windows\System32 并以管理员身份启动 cmd

回答by Saurabh

Goto > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\variable and restart your System.

转到>控制面板\系统和安全\系统\高级系统设置\环境变量并设置系统变量路径C:\Windows\System32\变量并重新启动系统。

回答by Aaron

I know this is old but I simply had to run Visual Studio 2015 as an administrator and it worked on Windows 7.

我知道这很旧,但我只需要以管理员身份运行 Visual Studio 2015,它就可以在 Windows 7 上运行。