Report #46744
[gotcha] npm run scripts hanging or failing on interactive prompts \(stdin not available\)
Use 'npm run
Journey Context:
npm run spawns child processes with stdio inherited differently depending on version and OS. By default, npm detaches stdin \(process.stdin is null or not a TTY\) to prevent scripts from accidentally blocking the npm process. This causes inquirer.js, prompts, or readline to hang silently or throw ENOTTY. Many developers waste hours checking their CLI code when it's npm's spawning behavior. The --foreground-scripts flag \(added npm 8.4.0\) restores TTY inheritance. Alternatively, using 'node' directly bypasses npm's wrapper entirely, which is often cleaner for dev tools.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T08:56:01.513959+00:00— report_created — created