Skip to content

Commit c5881e6

Browse files
committed
doc: Clarify behavior of --watch-path and --watch flags
1 parent 3e996df commit c5881e6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

doc/api/cli.md

+7
Original file line numberDiff line numberDiff line change
@@ -3056,6 +3056,10 @@ Use `--watch-path` to specify what paths to watch.
30563056
This flag cannot be combined with
30573057
`--check`, `--eval`, `--interactive`, or the REPL.
30583058

3059+
Note: The `--watch` flag requires a file path as an argument. It does not support
3060+
being used with `--run` or inline script input. If no file is provided, Node.js will
3061+
exit with status code 9.
3062+
30593063
```bash
30603064
node --watch index.js
30613065
```
@@ -3083,6 +3087,9 @@ combination with `--watch`.
30833087
This flag cannot be combined with
30843088
`--check`, `--eval`, `--interactive`, `--test`, or the REPL.
30853089

3090+
Note: Using `--watch-path` implicitly enables `--watch`, which requires a file path
3091+
and is incompatible with `--run`, as `--run` takes precedence and ignores watch mode.
3092+
30863093
```bash
30873094
node --watch-path=./src --watch-path=./tests index.js
30883095
```

0 commit comments

Comments
 (0)