运行 来自 WebStorm 的 NodeJs 脚本给出 "spawn cmd.exe ENOENT" 错误
running NodeJs script from WebStorm gives "spawn cmd.exe ENOENT" error
在 WebStorm 上作为构建配置执行 nodejs 脚本失败并出现以下错误:
Warning: spawn cmd.exe ENOENT Use --force to continue.
Aborted due to warnings.
运行 来自终端的相同脚本工作正常。失败的部分是 运行 grunt task(shell command):
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;
}
我尝试了 this answer 中描述的方法,但没有帮助。
cmd.exe
文件位于 c:\windows\system32
文件夹下。
可以在环境设置中使用快捷方式 %system32%
。
将 c:\windows\system32
添加到您的 PATH
环境变量,它应该可以工作!
在 WebStorm 上作为构建配置执行 nodejs 脚本失败并出现以下错误:
Warning: spawn cmd.exe ENOENT Use --force to continue.
Aborted due to warnings.
运行 来自终端的相同脚本工作正常。失败的部分是 运行 grunt task(shell command):
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;
}
我尝试了 this answer 中描述的方法,但没有帮助。
cmd.exe
文件位于 c:\windows\system32
文件夹下。
可以在环境设置中使用快捷方式 %system32%
。
将 c:\windows\system32
添加到您的 PATH
环境变量,它应该可以工作!