-
Notifications
You must be signed in to change notification settings - Fork 4k
Open
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps
Description
Is there an existing issue for this?
- I have searched the existing issues
This issue exists in the latest npm version
- I am using the latest npm
Current Behavior
Arguments are passed to the script when run on Mac:
process.argv: [
"/path/to/node",
"/path/to/test.js",
"--my-arg=value"
]
Arguments are not passed to the script when run on Windows:
process.argv: [
"C:\\Program Files\\nodejs\\node.exe",
"C:\\path\\to\\test.js"
]
The --my-arg=value is completely missing from process.argv.
Additionally, npm shows a warning:
npm warn Unknown cli config "--my-arg". This will stop working in the next major version of npm.
This suggests npm is treating the argument as an npm config option despite it appearing after --.
Expected Behavior
Arguments after -- should be passed to the script, regardless of platform:
process.argv: [
"/path/to/node",
"/path/to/test.js",
"--my-arg=value"
]
Steps To Reproduce
-
Create a minimal test project:
{ "name": "npm-args-test", "version": "1.0.0", "scripts": { "test-args": "node test.js" } }// test.js console.log('process.argv:', JSON.stringify(process.argv, null, 2));
-
Run the command with arguments:
npm run test-args -- --my-arg=value
Observe the output.
Environment
- npm: 11.x
- Node.js: 22.x
- OS Name: Windows 11/macOS Tahoe
- System Model Name: N/A
- npm config:
; "builtin" config from REDACTED
prefix = REDACTED
; "user" config from REDACTED
REDACTED
email = (protected)
script-shell = "pwsh"
; "project" config from REDACTED
always-auth = true
registry = REDACTED
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.13.0
; npm local prefix = REDACTED
; npm version = 11.7.0
; cwd = REDACTED
; HOME = REDACTED
; Run `npm config ls -l` to show all defaults.Metadata
Metadata
Assignees
Labels
Bugthing that needs fixingthing that needs fixingNeeds Triageneeds review for next stepsneeds review for next steps