events.js:72
throw er; // Unhandled \'error\' event
^
Error: spawn ENOENT
at errnoException (chil
I ran into the same problem, but I found a simple way to fix it.
It appears to be spawn()
errors if the program has been added to the PATH by the user (e.g. normal system commands work).
To fix this, you can use the which module (npm install --save which
):
// Require which and child_process
const which = require('which');
const spawn = require('child_process').spawn;
// Find npm in PATH
const npm = which.sync('npm');
// Execute
const noErrorSpawn = spawn(npm, ['install']);