Skip to content
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

[BUG] & npm @("run", "ci") in Powershell failed with EUNKNOWNCOMMAND #8176

Open
2 tasks done
adriangodong opened this issue Mar 21, 2025 · 2 comments
Open
2 tasks done
Labels
Bug thing that needs fixing Needs Triage needs review for next steps platform:windows is Windows-specific

Comments

@adriangodong
Copy link

adriangodong commented Mar 21, 2025

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

Execute the following Powershell command:

& npm @("run", "ci")

This works in Node 20 LTS / npm 10.1.0. In Node 22 LTS / npm 10.9.2, the following error is shown:

Unknown command: "run ci"

To see a list of supported npm commands, run:
  npm help

It seems that npm failed to parse the space and passes "run ci" to cmd-list.js deref. Workaround using & npm.cmd @("run", "ci") is also an option, so this could be an issue with npm.ps1?

Expected Behavior

The command should work as before (npm 10.1.0)

Steps To Reproduce

  1. Node 22 LTS / npm 10.9.1
  2. Run & npm @("run", "ci") in Powershell
  3. Got unknown command error

Environment

  • npm: 10.9.2
  • Node.js: v22.14.0
  • OS Name: Windows 11
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

prefix = "C:\\Users\\Adrian Godong\\AppData\\Roaming\\npm"

; "user" config from C:\Users\Adrian Godong\.npmrc

cache = "C:\\Users\\Adrian~1\\AppData\\Roaming\\npm-cache"

; "project" config from C:\Users\Adrian Godong\Desktop\pancore\develop\.npmrc

install-links = false
legacy-peer-deps = true
registry = "**redacted**"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v22.14.0
; npm local prefix = C:\Users\Adrian Godong\Desktop\**redacted**
; npm version = 10.9.2
; cwd = C:\Users\Adrian Godong\Desktop\**redacted**
; HOME = C:\Users\Adrian Godong
; Run `npm config ls -l` to show all defaults.
@adriangodong adriangodong added Bug thing that needs fixing Needs Triage needs review for next steps labels Mar 21, 2025
@milaninfy milaninfy added the platform:windows is Windows-specific label Mar 21, 2025
@milaninfy
Copy link
Contributor

This is working as expected on my end on the latest [email protected]. Also you can run npm ci for clean install.
For your use case could you please share the full logs and complete powershell output ?

@adriangodong
Copy link
Author

adriangodong commented Mar 28, 2025

This is working as expected on my end on the latest [email protected].

Can also repro the issue on npm 11.2.0.

Also you can run npm ci for clean install.

I have a custom script called ci. Same issue with other commands below.

For your use case could you please share the full logs and complete powershell output ?

PS > $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.26100.3624
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.3624
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS > npm -v
11.2.0

PS > & npm @("help", "access")
Unknown command: "help access"

To see a list of supported npm commands, run:
  npm help

I'm not sure how to get the full logs.

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
Projects
None yet
Development

No branches or pull requests

2 participants