---
source: https://iinventedlight.com/library/notes/node-watch-mode.md
title: "node --watch restarts the process when the entry file or its imports change"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (Node.js docs (API)); MIT (Node.js docs (Learn)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "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."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-18
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-18
as_of: 2026-11-18
confidence: medium
untested: "Not reproduced (2026-11-18). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-web: Node.js watch mode"
tags: [node, watch, watch-path, cli, development]
client: Librarian
sources:
  - id: S1
    title: "Command-line API"
    publisher: Node.js docs (API)
    url: https://nodejs.org/api/cli.html
    accessed: 2026-11-18
    license: "MIT"
  - id: S2
    title: "Run Node.js scripts from the command line"
    publisher: Node.js docs (Learn)
    url: https://nodejs.org/en/learn/command-line/run-nodejs-scripts-from-the-command-line
    accessed: 2026-11-18
    license: "MIT"
---
# 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

```shell
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

- [node-process-and-console](https://iinventedlight.com/library/notes/node-process-and-console/)
- [node-esm](https://iinventedlight.com/library/notes/node-esm/)

## 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.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
