npkill
npkill copied to clipboard
MaxListenersExceededWarning
Describe the bug
When running npx npkill from my home directory on macos, this error message displays at the top of the results:
MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
To Reproduce Steps to reproduce the behavior:
cdnpx npkill- See error
Expected behavior I expect npkill to have high-enough resource limits to scan a typical macos development computer.
Screenshot

- OS: macos 10.14.6
- Version v0.7.1
I'm having the same issue on macOS: 10.15.6 npkill: 0.7.1 npx npkill
Same issue with Windows 10 Pro using npx npkill
Same issue with Windows 10 Home using npx npkill v0.8.3 (latest version).
This seems to occur when we have deeply nested folders. For example, 5 folders deep, like:
C:\Work\Code\WebDev\ClientX\ProjectY
For my case, npkill does not even detect folders that are 4 layers deep (e.g. those "ClientX" folders), when I run npkill from the root directory (C drive).
So I agree with @quinncomendant that npkill should be able to scan through all deeply nested folders, by either:
- (A) Having high-enough resource limits by default; or
- (B) Allowing users to increase these limits (perhaps like a
-bruteforceflag?).
Hey guys! Thank you very much for opening the issue and for all the information provided.
I was never able to work on this because I never managed to replicate the problem UNTIL a while ago I realized that with npm run start -- -d ~ for some reason it did NOT crash. So I tried create a deeeeply nested folders as @EarthlingJim suggest and run npm run build; npm link; npkill (from home) (for simulate a real installation) and GOTCHA!.
I can bump the complete error:
(node:158396) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [Socket]. Use emitter.setMaxListeners() to increase limit
at _addListener (node:events:595:17)
at Socket.addListener (node:events:617:10)
at Socket.Readable.on (node:internal/streams/readable:876:35)
at Observable._subscribe (file:///home/juanimi/projects/npkill/lib/services/stream.service.js:14:20)
at Observable._trySubscribe (/home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/Observable.js:41:25)
at /home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/Observable.js:35:31
at Object.errorContext (/home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/util/errorContext.js:22:9)
at Observable.subscribe (/home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/Observable.js:26:24)
at /home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/operators/catchError.js:12:27
at OperatorSubscriber.<anonymous> (/home/juanimi/projects/npkill/node_modules/rxjs/dist/cjs/internal/util/lift.js:14:28)
So the problem all along has been here: https://github.com/voidcosmos/npkill/blob/a5c5406408a08293de094871e3019368969e67ee/src/services/stream.service.ts#L20
Indeed, by removing that line, no message will come again. I'm going to dig deeper into what's going on.
Omggg it can't be ._.
We forgot to delete that particular eventlistener (1 line).
The solution to this problem should be in this commit I just made: 802b2fa7029990b11a4dba231202b6b3df95d206
I have to do more extensive testing but I think this problem is solved.
Should be solved in v0.9.0 ๐
I can verify that it works perfectly fine now.
As you wrote, even deeeeply nested folders give no problems now. ๐คฃ
Thanks for fixing it, @zaldih ! ๐