每当我尝试使用具有
Worker 文件的工人时 =>
parentPort.on('message',msg =>{
//some code here
})
主文件 =>
server.listen(3000,function(){
console.log('Server running');
});
服务器已经在监听它给出了这个错误
Error: listen EADDRINUSE: address already in use 127.0.0.1:3000
at Server.setupListenHandle [as _listen2] (net.js:1314:16)
at listenInCluster (net.js:1362:12)
at GetAddrInfoReqWrap.doListen [as callback] (net.js:1499:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:68:8)
Emitted 'error' event on Worker instance at:
at Worker.[kOnErrorMessage] (internal/worker.js:233:10)
at Worker.[kOnMessage] (internal/worker.js:243:37)
at MessagePort.<anonymous> (internal/worker.js:164:57)
at MessagePort.emit (events.js:315:20)
at MessagePort.onmessage (internal/worker/io.js:78:8)
at MessagePort.exports.emitMessage (internal/per_context/messageport.js:11:10) {
code: 'EADDRINUSE',
errno: -98,
syscall: 'listen',
address: '127.0.0.1',
port: 3000
}
我试过使用 MessageChannel() 但它也给出了同样的错误。请您告诉错误的原因是什么以及如何纠正它。