从WebStorm运行NodeJs脚本时出现“spawn cmd.exe ENOENT”错误

3

在WebStorm上将nodejs脚本作为构建配置执行时,会出现以下错误:

Warning: spawn cmd.exe ENOENT Use --force to continue.

Aborted due to warnings.

从终端运行相同的脚本是没有问题的。失败的部分是运行grunt任务(shell命令):

function buildInserter(cb) {
  var defer = Q.defer();
  grunt.tasks([ 'shell:release-inserter' ], { gruntfile: './gruntfile.js' }, function () {
    defer.resolve();
    if( typeof cb === 'function' ) {
      cb();
    }
  });

  return defer.promise;
}

我试过了这个答案中描述的方法,但是没有帮助。


2
我猜测,cmd.exe或node二进制文件不在环境路径中。 - Daniel W.
1
C:\Windows\system32缺失。谢谢。我可以请您将此作为答案添加吗? - Serhiy
1个回答

1
"

cmd.exe文件位于c:\windows\system32文件夹下。

在环境设置中可以使用快捷方式%system32%

c:\windows\system32添加到您的PATH环境变量中,它就能正常工作了!

"

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接