
For context, routes\index.js:87 is around my exec (sync) or inside my exec (async).
I am getting this error with either spawn, exec, or execFile, using the libraries child_process, win-spawn, or cross-spawn.
I've tried running node, npm, grunt, ant (Apache), etc. -- which all work from command line with no problems -- with and without parameters, with and without options, sync and async, and I always get this exact error (same line and column).
I spent all day yesterday looking for solutions, found solutions on here, and on Github (node), tried everything I found, but nothing solved the problem.
I will provide any info you think will help to solve the problem. Thanks for your support.
-
Requested by Ben Fortune (have tried sync and async of all, only shown first example):
var exec = require('child_process').exec;
exec('node', function(err){
if(err) throw err;
});
-
var exec = require('child_process').exec;
var child = exec('node');
child.on('error', function(){ throw arguments['0']; });
-
var exec = require('child_process').execFile;
exec('/path/to/node', function(err){
if(err) throw err;
}
-
var spawn = require('child_process').spawn
spawn('node', function(err){
if(err) throw err;
}
-
var spawn = require('child_process').spawn
spawn('cmd', ['/s', '/c', '"C:\\mycmd.bat"'], {
windowsVerbatimArguments: true
});
I have tried all of these with the packages win-spawn and cross-spawn, with and without the '.exec' (etc.) affixes to the require. I have tried options like stdio: 'inherit'.
I am using Windows 8.1 64-bit, running command as Administrator.
-
Node js - Error: spawn ENOENT (Windows 8.1)
http://www.zescience.com/node-js-error-spawn-enoent-windows-8-1-167370
A couple of examples with the same error, except in my case, I am calling the exec function, not some 3rd party package.
I've also tried putting the exec elsewhere in code, location of the call is not the problem.
Possibly related: https://github.com/joyent/node/issues/2318
Where win-spawn and cross-spawn failed, spawn-cmd worked.
I have no idea why cross-spawn didn't work when spawn-cmd did, as they're pretty similar, but there you go. As to the original problem, I guess it's an issue with node.