任何人都知道如何在
windows上运行Node Cluster?我无法在网路上找到任何文章,似乎无法解决这个问题:
events.js:160 throw er; // Unhandled 'error' event ^ Error: write ENOTSUP at exports._errnoException (util.js:1007:11) at ChildProcess.target._send (internal/child_process.js:634:20) at ChildProcess.target.send (internal/child_process.js:521:19) at sendHelper (cluster.js:751:15) at send (cluster.js:534:12) at cluster.js:509:7 at SharedHandle.add (cluster.js:99:3) at queryServer (cluster.js:501:12) at Worker.onmessage (cluster.js:449:7) at ChildProcess.<anonymous> (cluster.js:765:8)
和代码…
if (cluster.isMaster) { for (let i = 0; i < numcpus; i++) { cluster.fork(); } cluster.on('online',(worker) => { console.log('Worker ' + worker.process.pid + ' is online'); }); cluster.on('exit',(worker,code,signal) => { console.log(`Worker ${worker.process.pid} died with code ${code} and signal ${signal}`); }); } else { console.log('else part '); openPort(); } function openPort() { let server = dgram.createSocket('udp4'); server.bind(port,host); server.on('message',processMessage); }