Watch mode causes infinite process spawning when used via NODE_OPTIONS.
The issue involves NODE_OPTIONS=--watch causing infinite process spawning instead of normal execution. The problem appears related to watch mode initialization and needs investigation of process spawning behavior. A maintainer has linked it to a previous PR (#60178), suggesting some existing context exists.
v25.6.0
Darwin <redacted> 24.6.0 Darwin Kernel Version 24.6.0: Wed Nov 5 21:33:58 PST 2025; root:xnu-11417.140.69.705.2~1/RELEASE_ARM64_T6000 arm64 arm Darwin
No response
test.js and make it executable:
#!/usr/bin/env node
console.log('hello');
NODE_OPTIONS="--watch" ./test.jsThis is always reproducible.
I would expect it to run normally, producing hello in stdout and then exiting.
There is no output. I can see in my process list that there are hundreds of node processes spawning.
This seems to be the same issue as https://github.com/nodejs/node/issues/51159. For additional context, my intent was to reuse a bin entrypoint in package.json but with --watch mode, so under the scripts field it looked roughly like:
"scripts": {
"dev": "NODE_OPTIONS='--watch' app",
}
...where app is in node_modules/.bin/.
Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!