Node.js "nodemon" Watcher Hangs the CI Job
nodemon is a long-running file watcher meant for development. Started in CI, it never exits on its own, so the job hangs until it times out, or fails with ENOSPC when it runs out of watches.
What this error means
A CI step that runs nodemon (often via a dev script) hangs and is eventually killed by the job timeout, or fails immediately with an inotify ENOSPC error.
[nodemon] starting `node src/index.js`
[nodemon] watching path(s): **/*
# job hangs here until the CI timeout firesCommon causes
A watch command ran in CI
A dev/watch script that uses nodemon was used in a CI step. Watchers do not terminate, so the step never completes.
Watcher exhausts inotify watches
On a large tree, nodemon may also hit the file-watcher limit and fail with ENOSPC before it would otherwise hang.
How to fix it
Use the non-watch command in CI
Run the plain start/build/test command instead of the watch variant.
# CI runs this, not "nodemon src/index.js"
node src/index.js
# or for tests
npm testIf a server is needed, background it and gate on readiness
Start the server in the background, wait for it, run the task, then let the job exit.
- Start the server with
node ... &(no watcher). - Wait on its port with wait-on.
- Run the dependent task, then the job exits.
How to prevent it
- Never run watch commands (nodemon) in CI steps.
- Keep
devandstart/ciscripts separate. - Background and readiness-gate any server CI needs.