nodejs / nodejs/node

`process.execArgv` does not include `--watch` or `--watch-path` options or their values on Windows

Open
#60,594 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

stale watch-mode
Dominant language
JavaScript
Stars
122k
Forks
37.3k
Avg merge
4d 2h
Merged PRs (30d)
283

Description

Version

v24.11.0

Platform
Microsoft Windows NT 10.0.19045.0 x64
Subsystem

process

What steps will reproduce the bug?
  1. Create a build.js file:
/** @file build.js */
import { execArgv } from "node:process";
console.warn(execArgv);
  1. Create an empty file named template.html (content does not matter).

  2. Run the following command:

(node --watch-path=template.html build.js & node --watch-path template.html build.js & node --watch build.js) > /dev/null
How often does it reproduce? Is there a required condition?

Always reproducible when --watch or --watch-path options are specified on the node command line.

What is the expected behavior? Why is that the expected behavior?

Expected output:

[ '--watch-path=template.html' ]
[ '--watch-path', 'template.html' ]
[ '--watch' ]

According to Node.js documentation, process.execArgv should contain the Node options passed before the script name.

What do you see instead?
[]
[]
[]
Additional information

Bash is installed on my Windows system. I used it in the reproduction steps because it makes it easier to chain blocking commands and run them in the background compared to PowerShell or Command Prompt.
Press Ctrl+C to terminate all background processes at once.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the Windows reproduction command and inspecting how process.execArgv handles the --watch and --watch-path options before the script name. The fix is complete when both option forms and their values appear in process.execArgv as shown in the expected output, while preserving the behavior for the three provided commands.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.