running scripts is disabled 🪟 Windows

File cannot be loaded because running scripts is disabled on this system (PowerShell execution policy)

PowerShell’s execution policy blocks .ps1 scripts — including npm/yarn/pnpm shims like npm.ps1.

Seen on: Windows

Meaning

Windows defaults to Restricted on client machines. Tools installed via npm, Python venv Activate.ps1 and other scripts fail until the policy allows local scripts. Organisations may enforce policy via GPO.

Common causes

  • Execution policy Restricted (default on Windows clients)
  • Script downloaded from the internet (Zone.Identifier) under RemoteSigned
  • GPO enforcing the policy

⚡ Quick fix

  1. Set-ExecutionPolicy -Scope CurrentUser RemoteSigned
  2. Unblock downloaded scripts (Unblock-File)
  3. Use npm.cmd or bypass for one run: powershell -ExecutionPolicy Bypass -File script.ps1

Detailed fix by platform

PowerShell

  1. powershell
    Get-ExecutionPolicy -List
    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
    Unblock-File .\script.ps1

How to diagnose

  1. Policy — Get-ExecutionPolicy -List (which scope wins)
  2. GPO — MachinePolicy/UserPolicy set?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.