Search code examples
node.jswebstorm

running NodeJs script from WebStorm gives "spawn cmd.exe ENOENT" error


Executing nodejs script as Build Configuration on WebStorm fails with the following error:

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

Aborted due to warnings.

Running the same script from terminal works fine. The failing part is running 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;
}

I tried approach described in this answer, but it didn't help.


Solution

  • The cmd.exe file is located under the c:\windows\system32 folder.

    The shortcut %system32% can be used within environment settings.

    Add c:\windows\system32 to your PATH environment variable and it should work!