我收到以下警告:
(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);