[英]Discord.js Error - MaxListenersExceededWarning: Possible EventEmitter memory leak detected
Every time I try to make more than 10 commands I get the error:每次我尝试执行超过 10 个命令时,我都会收到错误消息:
node MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 message listeners added to [Client]. Use emitter.setMaxListeners() to increase limit
I tried fixing it by doing emitter.setMaxListeners()
and it didn't fix it so I searched online and tried to fix it by using process.setMaxListeners(0);
我尝试通过执行
emitter.setMaxListeners()
来修复它,但它没有修复它所以我在网上搜索并尝试通过使用process.setMaxListeners(0);
but that didn't work either.但这也没有用。 If there is a fix for this please let me know, and if you want to see what code I have written for my bot please let me know which part of the code you would like to see.
如果对此有修复,请告诉我,如果您想查看我为我的机器人编写的代码,请告诉我您希望查看代码的哪一部分。
const client = new Discord.Client();
client.setMaxListeners(0);
it's not emitter or process you are doing it to, it's the client.它不是发射器或您正在执行的过程,它是客户端。 Oh and I am pretty sure you need it at the top of your code, before your commands
哦,我很确定你需要它在你的代码顶部,在你的命令之前
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.