Skip to Content
Last repository update 9/10/2025 🎉

Fix "Running Scripts is Disabled on This System" Error When Using npm on Windows

Learn how to fix "Running Scripts is Disabled on This System" Error When Using npm on Windows

karchunt

Kar Chun Tan

Creator

Metadata

Fri Sep 12 2025

2 min read

300 words

Fix “Running Scripts is Disabled on This System” Error When Using npm on Windows

After installing Node.js on a Windows machine, you might encounter the following error when trying to run npm commands in PowerShell:

File C:\Program Files\nodejs\npm.ps1 cannot be loaded because running scripts is disabled on this system

This error indicates that PowerShell’s execution policy is preventing the npm.ps1 script from running. This is a security measure in Windows to prevent unauthorized script execution.

To resolve this, the PowerShell execution policy needs to be adjusted. The recommended approach is to set the execution policy to RemoteSigned for the current user scope.

Open PowerShell as Administrator

Search for “PowerShell” in the Start menu, right-click on “Windows PowerShell,” and select “Run as administrator.”

Check the Current Execution Policy (Optional)

To check the current execution policy, run the following command:

Get-ExecutionPolicy

Sample output:

PS C:\WINDOWS\system32> Get-ExecutionPolicy Restricted

If it shows Restricted, the policy needs to be changed.

Set the Execution Policy to RemoteSigned for the Current User

Run the following command to set the execution policy:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

You will be prompted to confirm the change; type Y and press Enter.

PS C:\WINDOWS\system32> Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned Execution Policy Change The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose you to the security risks described in the about_Execution_Policies help topic at https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy? [Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y

Verify the Change (Optional)

To confirm that the execution policy has been changed, you can run the following command:

Get-ExecutionPolicy -List
PS C:\WINDOWS\system32> Get-ExecutionPolicy -List Scope ExecutionPolicy ----- --------------- MachinePolicy Undefined UserPolicy Undefined Process Undefined CurrentUser RemoteSigned LocalMachine Undefined

Confirm that CurrentUser now shows RemoteSigned. After completing these steps, you should be able to run npm commands without encountering the execution policy error.

Last updated on