Skip to content

[BUG] npm commands don't work on PowerShell (but work on Command Prompt) #6710

@andradei

Description

@andradei

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

I tried installing node and npm (shipped with node) with each of these tools (one at a time)

  • Scoop
  • Winget
  • Direct download from official site

And I have the same issue with all of them where:

  • Node runs fine on both Command Prompt and PowerShell
  • npm works only on Command Prompt but not on PowerShell

image

How do I make npm work on PowerShell?

Expected Behavior

npm commands work in PowerShell like they do in Command Prompt.

Steps To Reproduce

  1. Install node (comes with npm) from the official site (for Windows 10)
  2. Run npm -version on PowerShell

Environment

  • npm: 9.6.7
  • Node.js: v18.17.1
  • OS Name: Windows 11 (tried on 10 as well)
  • System Model Name: 22H2
  • npm config:
; "builtin" config from C:\Program Files\nodejs\node_modules\npm\npmrc

cache = "C:\\Program Files\\nodejs\\cache"
prefix = "C:\\Program Files\\nodejs\\bin"

; node bin location = C:\Program Files\nodejs\node.exe
; node version = v18.17.1
; npm local prefix = C:\Users\me
; npm version = 9.6.7
; cwd = C:\Users\me
; HOME = C:\Users\me
; Run `npm config ls -l` to show all defaults.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingNeeds Triageneeds review for next stepsRelease 9.xwork is associated with a specific npm 9 release

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions