Skip to content

[BUG] npm-run-script "-- --flag=value" args intercepted as npm config on Windows but not on Linux #9353

Description

@xSuiteKevinSartiano

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

When running npm run <script> -- --foo=bar on Windows, npm intercepts --foo as an unknown CLI config option and strips it from the arguments passed to the script. The script receives no arguments.

> npm run debug -- --foo=bar  
npm warn Unknown cli config "--foo". This will stop working in the next major version of npm.

> my-package@1.0.0 debug
> echo param:

param:

Expected Behavior

Arguments after -- should be forwarded as-is to the script. This is the expected behavior observed on Linux:

$ npm run debug -- --foo=bar

> my-package@1.0.0 debug
> echo param: --foo=bar

param: --foo=bar

Steps To Reproduce

  1. In a Windows environment
  2. Create a package.json with a simple script:
   {
     "scripts": {
       "debug": "echo param:"
     }
   }
  1. Run npm run debug -- --foo=bar
  2. See error npm warn Unknown cli config "--foo". This will stop working in the next major version of npm. and that no params is printed to console.

Environment

  • npm: npm@11.14.1
  • Node.js: node@v24.13.0
  • OS Name: Windows 11 Enterprise
  • System Model Name: Dell Precision 3581
  • npm config:
; "user" config from C:\Users\***\.npmrc

before = "2026-05-10T14:12:30.871Z"
ignore-scripts = true
min-release-age = 3

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v24.13.0
; npm local prefix = C:\Users\***\Desktop\npm-debug
; npm version = 11.14.1
; cwd = C:\Users\***\Desktop\npm-debug
; HOME = C:\Users\***
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingPriority 2secondary priority issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions