events.js:72
throw er; // Unhandled \'error\' event
^
Error: spawn ENOENT
at errnoException (chil
I ran into this problem on Windows, where calling exec
and spawn
with the exact same command (omitting arguments) worked fine for exec
(so I knew my command was on $PATH
), but spawn
would give ENOENT. Turned out that I just needed to append .exe
to the command I was using:
import { exec, spawn } from 'child_process';
// This works fine
exec('p4 changes -s submitted');
// This gives the ENOENT error
spawn('p4');
// But this resolves it
spawn('p4.exe');
// Even works with the arguments now
spawn('p4.exe', ['changes', '-s', 'submitted']);