node
node copied to clipboard
`--watch-path` combined with `--run` fails
Version
22.15.0
Platform
Darwin **** 24.3.0 Darwin Kernel Version 24.3.0: Thu Jan 2 20:24:23 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6020 arm64
Subsystem
No response
What steps will reproduce the bug?
Running --watch-path with --run fails.
$ node --watch-path=./src --run build
# node: --watch requires specifying a file
How often does it reproduce? Is there a required condition?
Always
What is the expected behavior? Why is that the expected behavior?
It should run the script just like it would run a file, or it should run the script without the watch. The behaviour watch behaviour and the execution behaviour should be independent of each other.
What do you see instead?
It fails
Additional information
No response
Hi! Thanks for the bug report.
This seems to be a misuse of Node.js and not a bug. It is a documentation issue.
Apparently, watch-path implies watch1, and watch flag needs a file2. If you are interested, feel free to open a PR updating the documentation.
Hi! I came here for the same issue. Opened a PR addressing it in the docs