My code

var child_process = require('child_process'); var fs = require('fs'); var st = 'xvfb-run node --harmony'; start('app.js'); function start(nodefile) { if (typeof start !== 'string') { console.log('Has none file. like this: start("app.js")'); } console.log('Master process is running. '); setTimeout(function() { var proc = child_process.spawn(st, [nodefile]); proc.stdout.on('data', function(data) { console.log(data.toString()); }); proc.stderr.on('data', function(data) { console.log(data.toString()); }); proc.on('exit', function(code) { console.log('child process exited with code ' + code); setTimeout(function() { delete(proc); }, 10000); start('app.js'); }); }, 5000); } 

Onboard nightmare js runs on ubuntu. And it runs in a certain way: xvfb-run node --harmony app.js. And he in this form gives an error

 Error: spawn xvfb-run node --harmony ENOENT 

How do I run correctly?

  • To you, node.js makes it clear: ENOENT (no entity). This means that your command is incorrect. - Dmitriy Simushev
  • .spawn('xvfb-run', ['node', '--harmony', nodefile]) . The documentation clearly states that the arguments must be a separate array (as opposed to .exec ) - Alexey Ten

0