Skip to content

[BUG] when installing npm npm.ps1 is generated, ps1 files don't handle -- as expected! #4903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
2 tasks done
AnderssonPeter opened this issue May 16, 2022 · 2 comments
Closed
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps platform:windows is Windows-specific Release 8.x work is associated with a specific npm 8 release

Comments

@AnderssonPeter
Copy link

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

If I run npm run test -- --value '10' the npm.ps1 file removes the -- this in turn removes all parameters that start with --.

 > npm run test -- --value '10'

> [email protected] test
> node test.js "10"

if I remove npm.ps1 powershell instead executes npm.cmd and everything works as expected.

npm run test -- --value '10'

> [email protected] test
> node test.js "--value" "10"

I am using PowerShell 7.2.3

The only workaround besides deleting npm.ps1 is to add quotes around the --.

Expected Behavior

The -- should be passed to npm so that argument parsing works as intended.

Steps To Reproduce

  1. Install node
  2. Upgrade to latest npm with npm install -g npm
  3. Ensure that you have a npm script named test that runs a node file example "test": "node test.js".
  4. Run 'npm run test -- --value '10'`
  5. See error...

Environment

  • npm: 8.10.0
  • Node.js: 18.1.0 or 16.15.0
  • OS Name: Windows 10
  • System Model Name: ???
  • npm config:
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.1.0
; npm local prefix = T:\eslint-issue
; npm version = 8.10.0
; cwd = T:\eslint-issue
; HOME = D:\Users\Peter
; Run `npm config ls -l` to show all defaults.```
@AnderssonPeter AnderssonPeter added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels May 16, 2022
@mbtools
Copy link
Contributor

mbtools commented May 12, 2025

Closed by #8278 (semver 7.7.2)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps platform:windows is Windows-specific Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

5 participants