-
Notifications
You must be signed in to change notification settings - Fork 353
Open
Labels
Description
- I have searched for similar issues
I'm using npm-check-updates as a module and running ncu sequentially:
import ncu from "npm-check-updates";
for (meta of metas) {
await ncu.run({
packageFile : path.join(meta.dirs.root.abs, "package.json"),
configFilePath : meta.dirs.root.abs,
deprecated : false,
install : "never",
format : "group",
interactive : true
});
}After ~9/10 iterations I systematically get the following warning:
(node:15396) MaxListenersExceededWarning: Possible EventEmitter memory leak detected.
11 exit listeners added to [process]. MaxListeners is 10.
Use emitter.setMaxListeners() to increase limit
at genericNodeError (node:internal/errors:985:15)
at wrappedFn (node:internal/errors:539:14)
at _addListener (node:events:582:17)
at process.addListener (node:events:600:10)
at vg (/Users/yvele/projects/my-cli/node_modules/npm-check-updates/build/index.js:664:182)
at async UpgradeDependencies.runOnPackageCore (/Users/yvele/projects/my-cli/lib/UpgradeDependencies.js:70:5)
Using:
- Node.js v24.13.0
- npm version 11.6.2
- npm-check-updates v19.5.0
- MacBook Pro M1 / macOS Sequoia 15.7.3
Note that when running ncu executable with the same options using spawn I get no warning at all:
for (meta of metas) {
await spawn(ncu, [
"--packageFile", path.join(meta.dirs.root.abs, "package.json"),
"--configFilePath", meta.dirs.root.abs,
"--no-deprecated",
"--install", "never",
"--format", "group",
"--interactive"
], {
stdio : "inherit"
});
}Possibly related to:
- Event listeners should be cleaned up (MaxListenersExceededWarning - possible memory leak detected) #597
- fix(api): prevent MaxListenersExceededWarning #601
Note that same MaxListenersExceededWarning warnings can also be seen in:
Reactions are currently unavailable