我正在使用node.js並使用集羣模塊。每次我跑cluster.fork(),我總是得到一個每次運行cluster.fork()時,都會得到一個錯誤:bind EADDRINUSE
throw er; // Unhandled 'error' event
Error: bind EADDRINUSE
at exports._errnoException (util.js:746:11)
at cb (net.js:1205:33)
at rr (cluster.js:592:14)
at Worker.<anonymous> (cluster.js:563:9)
at process.<anonymous> (cluster.js:692:8)
at process.emit (events.js:129:20)
at handleMessage (child_process.js:324:10)
at Pipe.channel.onread (child_process.js:352:11)
我一直在谷歌上搜索這個,我不知道這是怎麼發生的,因爲我沒有在任何端口號傳遞。
感謝
編輯:郵政代碼
var setupWorkers = function() {
if (cluster.isMaster) {
// Fork workers.
for (var i = 0; i < 5; i++) {
cluster.fork();
}
}
,這是一個被稱爲中,我通過調用節點運行app.js功能app.js
請張貼您的代碼。 – baao
你使用什麼節點版本? – laggingreflex
我正在使用節點v0.12.7 – Gakho