Skip to content

doc: clarify --watch and --watch-path usage with --run #58136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -3056,6 +3056,10 @@ Use `--watch-path` to specify what paths to watch.
This flag cannot be combined with
`--check`, `--eval`, `--interactive`, or the REPL.

Note: The `--watch` flag requires a file path as an argument and is incompatible
with `--run` or inline script input, as `--run` takes precedence and ignores watch
mode. If no file is provided, Node.js will exit with status code `9`.

```bash
node --watch index.js
```
Expand Down Expand Up @@ -3083,6 +3087,9 @@ combination with `--watch`.
This flag cannot be combined with
`--check`, `--eval`, `--interactive`, `--test`, or the REPL.

Note: Using `--watch-path` implicitly enables `--watch`, which requires a file path
and is incompatible with `--run`, as `--run` takes precedence and ignores watch mode.

```bash
node --watch-path=./src --watch-path=./tests index.js
```
Expand Down