从WebStorm运行NodeJs脚本会出现“spawn cmd.exe ENOENT”错误
在WebStorm上以Build Configuration执行nodejs脚本失败,并出现以下错误:
Warning: spawn cmd.exe ENOENT Use --force to continue. Aborted due to warnings.
从terminal运行相同的脚本工作正常。 失败的部分正在运行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; }
我尝试了这个答案中描述的方法,但没有帮助。
cmd.exe
文件位于c:\windows\system32
文件夹下。
可以在环境设置中使用快捷方式%system32%
。
将c:\windows\system32
添加到您的PATH
环境variables,它应该工作!