node --watch restarts the process when the entry file or its imports change
Answer: node --watch app.js starts Node.js in watch mode, where the Node.js process restarts on changes in the watched files. By default it watches the entry point and any required or imported module. Watch mode is stable since v22.0.0 and v20.13.0.
Commands
node --watch app.js
node --watch-path=./src --watch-path=./config server.js
node --watch --watch-kill-signal SIGINT test.js
node --test --watch
Flags
--watch: added in v18.11.0 and v16.19.0. Restarts on changes to the entry point and its required or imported modules.--watch-path: starts Node.js in watch mode and specifies what paths to watch. This turns off watching of required or imported modules, so list every path you need.--watch-kill-signal: customizes the signal sent to the process on watch mode restarts.--watch-preserve-output: keeps the console output between restarts.- The test runner supports running in watch mode since v19.2.0 and v18.13.0.
Use
The --watch option automatically restarts the application when a file changes, which is useful for development purposes.
See also
Claims
- id: C1 claim: In watch mode, file changes restart the process. source: S1 evidence: "changes in the watched files cause the Node.js process to restart"
- id: C2 claim: By default the entry point and imported modules are watched. source: S1 evidence: "watch mode will watch the entry point and any required or imported module"
- id: C3 claim: Watch mode is stable. source: S1 evidence: "Watch mode is now stable."
- id: C4 claim: --watch restarts the application when a file changes. source: S2 evidence: "to automatically restart the application when a file changes"
Sources
- [S1] Command-line API. Node.js docs (API). https://nodejs.org/api/cli.html . License: MIT. Accessed 2026-11-18.
- [S2] Run Node.js scripts from the command line. Node.js docs (Learn). https://nodejs.org/en/learn/command-line/run-nodejs-scripts-from-the-command-line . License: MIT. Accessed 2026-11-18.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Node.js docs (API), Command-line API; Node.js docs (Learn), Run Node.js scripts from the command line. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Node.js docs (API), Command-line API; Node.js docs (Learn), Run Node.js scripts from the command line. MIT (https://raw.githubusercontent.com/nodejs/node/main/LICENSE). Copyright Node.js contributors.
Cite this
iinventedlight. 2026. "node --watch restarts the process when the entry file or its imports change." iinventedlight Library, iil:note:566w6xnt, version of 2026-11-18. https://iinventedlight.com/library/notes/node-watch-mode/. License: CC-BY-4.0.
@misc{iil_note_566w6xnt,
author = {{iinventedlight}},
title = {{node --watch restarts the process when the entry file or its imports change}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-18},
url = {https://iinventedlight.com/library/notes/node-watch-mode/},
note = {Permanent ID iil:note:566w6xnt. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- node-watch-mode.table.json (table; CC-BY-4.0)
- node-watch-mode.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/node-watch-mode.md.