grunt-contrib-watch icon indicating copy to clipboard operation
grunt-contrib-watch copied to clipboard

emitter.setMaxListeners()

Open drgould opened this issue 9 years ago • 5 comments

Just thought I'd drop this here since it took me FOREVER to figure this out.

If you're getting these errors:

warning: possible EventEmitter memory leak detected. 11 listeners added. Use emitter.setMaxListeners() to increase limit.

just set the maxListeners option in your watch config to something large. Like this:

watch: {
  options: {
    maxListeners: 99,
    ...
  }
}

Hope this helps.

drgould avatar Jul 14 '14 17:07 drgould

Thanks, @drgould! @shama, what do you think about processing this warning in the task to tell people to set maxListeners instead of emitter.setMaxListeners()?

jamesplease avatar Jul 14 '14 17:07 jamesplease

Sounds good to me.

shama avatar Jul 14 '14 17:07 shama

if (process.setMaxListeners) { process.setMaxListeners(10000); }

rubensbiork avatar Feb 24 '15 20:02 rubensbiork

was searching for this as Smeagol was searching for his precious.

arifulhb avatar May 11 '17 06:05 arifulhb

https://stackoverflow.com/a/31443386

Josufst avatar Aug 23 '19 11:08 Josufst