[BUG] After npm upgrade, on Windows getting error that npm.ps1 is not digitally signed
Open
Nobody has claimed this yet.
Bug
platform:windows
Priority 2
- Dominant language
- JavaScript
- Stars
- 10.1k
- Forks
- 4.7k
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 19
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
I upgraded npm using npm install -g npm@10.5.0, and then afterwards, I can't use the npm command since I get the code execution error that npm.ps1 is not digitally signed
npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded. The file C:\Program Files\nodejs\npm.ps1 is not digitally signed. You
cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.```
### Expected Behavior
It should be able to be run without having to risk the computer's security by allowing unsigned scripts.
### Steps To Reproduce
1. In Windows 11 with Node v20.11.0, upgrade npm from 10.2.4 `npm install -g npm@10.5.0` in Powershell
2. Try to run any npm command (e.g. `npm install`)
3. Get the error that npm.ps1 is not signed
### Environment
- npm: 10.5.0
- Node.js: 20.11.0
- OS Name: Windows 11 Pro
- System Model Name: ?
- npm config:
```ini
; node bin location = C:\Program Files\nodejs\node.exe
; node version = v20.11.0
; npm local prefix = C:\Users\anonmily\Projects\myapp
; npm version = 10.5.0
; cwd = C:\Users\anonmily\Projects\myapp
; HOME = C:\Users\anonmily
; Run `npm config ls -l` to show all defaults.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the global upgrade from npm 10.2.4 to 10.5.0 on Windows 11 with Node 20.11.0 in PowerShell, then inspect how the upgrade produces npm.ps1 and how PowerShell execution policy handles it. Done means npm commands work after the upgrade without requiring users to weaken script-signing security.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js
- Domain
- cli, operating-systems, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100