我收到以下警告:
(node) warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit. Trace: at EventEmitter.<anonymous> (events.js:139:15) at EventEmitter.<anonymous> (node.js:385:29) at Server.<anonymous> (server.js:20:17) at Server.emit (events.js:70:17) at HTTPParser.onIncoming (http.js:1514:12) at HTTPParser.onHeadersComplete (http.js:102:31) at Socket.ondata (http.js:1410:22) at TCP.onread (net.js:354:27)
我在 server.js 中写了这样的代码:
http.createServer( function (req, res) { ... }).listen(3013);
如何解决这个问题?
这在节点 eventEmitter 文档中进行了解释
这是什么版本的Node?你还有什么其他代码?那不是正常的行为。
简而言之,它的:process.setMaxListeners(0);
process.setMaxListeners(0);