単純なノード プログラムの実行中に次のエラーが発生します。
/home/ubuntu/parent.js:4
throw error;
^
Error: Command failed: /bin/sh: 1: node: not found
at ChildProcess.exithandler (child_process.js:637:15)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Socket.<anonymous> (child_process.js:948:11)
at Socket.EventEmitter.emit (events.js:95:17)
at Pipe.close (net.js:466:12)
親.js:
var exec = require('child_process').exec;
exec('node child.js',{env: {number: 123}},function(error,stdout,stderr){
if(error){ throw error; } console.log('stdout:\t',stdout);
console.log('stderr:\t',stderr);
});
child.js :
var number = process.env.number;
console.log(typeof(number));