Node Expressjs 里面,用子进程( child_process.fork )执行 js 就会报错,错误信息如下:
Error: listen EADDRINUSE
at exports._errnoException (util.js:746:11 )
at Agent.Server._listen2 (net.js:1156:14 )
at listen (net.js:1182:10 )
at Agent.Server.listen (net.js:1267:5 )
at Object.start (_debugger_agent.js:20:9 )
at startup (node.js:86:9 )
at node.js:814:3
源码:
POST: process.send ('123');
var code = req.body.toString ('utf8');
var crawlerPath = __dirname+'/some/path/test';
fs.writeFileSync (crawlerPath+'.js',code,'utf8');
var crawlerProcess = cp.fork (crawlerPath );