Skip to main content
After installing Node.js on Windows, you might encounter this error when running npm commands in PowerShell:
File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system
This error occurs because PowerShell’s execution policy is preventing the npm.ps1 script from running. The recommended fix is to set the execution policy to RemoteSigned for the current user scope.
1
Open PowerShell as Administrator
2
Search for “PowerShell” in the Start menu, right-click “Windows PowerShell”, and select “Run as administrator”.
3
(Optional) Check the current execution policy
4
Get-ExecutionPolicy
5
Sample output:
6
Restricted
7
If it shows Restricted, the policy needs to be changed.
8
Set the execution policy to RemoteSigned
9
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
10
You will be prompted to confirm — type Y and press Enter:
11
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust...
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
12
(Optional) Verify the change
13
Get-ExecutionPolicy -List
14
Sample output:
15
        Scope ExecutionPolicy
        ----- ---------------
MachinePolicy       Undefined
   UserPolicy       Undefined
      Process       Undefined
  CurrentUser    RemoteSigned
 LocalMachine       Undefined
16
Confirm that CurrentUser now shows RemoteSigned. After completing these steps, you should be able to run npm commands without the execution policy error.

Build docs developers (and LLMs) love