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

val*_*e93 28 cmd spawn node.js cordova

当我尝试构建(模拟)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
Run Code Online (Sandbox Code Playgroud)

val*_*e93 66

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

希望,它也可以帮到你.

  • 你把它添加到路径中了吗?还是您创建了一个新变量? (8认同)

小智 14

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


Aar*_*ron 6

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


Sau*_*abh 6

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