I'm currently trying to run process using spawn
. What I am trying to run from shell is the following;
NODE_ENV=production node app/app.js
Here's the code to run that;
var spawn = require('child_process').spawn;
var start = spawn('NODE_ENV=production',['node','app/app.js']);
However, I got the following error;
events.js:72
throw er; // Unhandled 'error' event
^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)
How can I do that using spawn
?