Omniscio

OmniscioGuidesRunning scripts is disabled

npm.ps1 cannot be loaded because running scripts is disabled on this system

On Windows, npm installs a small .ps1 file for each command it provides, and PowerShell loads that file before running anything. A machine whose execution policy forbids script files stops there, so the command never starts.

Last checked against Anthropic's documentation on November 25, 2026. By the Omniscio team. Updated .

What does the error look like?

Installing or running Claude Code through npm on Windows fails like this:

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.
...
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException

The block is longer than this in your terminal, and two parts matter: the sentence about running scripts being disabled, and the SecurityError category. The path is your own Node.js folder.

After an npm install the same error names claude.ps1 instead, when you run claude. It is the same refusal, one command further along.

What does it mean?

PowerShell's execution policy is blocking the .ps1 launcher scripts that npm creates for its commands. npm writes one of those files beside each command it installs, and the policy applies to script files, so the file is refused before it runs.

The refusal happens before the command starts, so nothing was installed wrongly and nothing is missing. This is not a Claude Code error, and reinstalling changes nothing while the policy stands.

Anthropic's setup page has you run the install command from PowerShell or CMD, and states that the native install does not need to be run as Administrator. The policy question is separate from both.

How do I fix it?

  1. Call the .cmd launcher instead of the .ps1 one. Anthropic says npm.cmd and claude.cmd do the same job, and the execution policy does not cover them. So npm.cmd install -g @anthropic-ai/claude-code works where npm did not, and after that claude.cmd stands in for claude. It changes no policy and no setting. It is a workaround rather than a repair: you type the suffix every time, and anything else that calls bare npm still meets the same error.
  2. Allow locally created scripts for your user. Anthropic's command is Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, run in PowerShell, then the command is retried. The scope names your own user rather than the whole machine. This does change a security setting on your account, and on a computer your employer manages the command may be refused; where it succeeds, it is still a change to a setting that machine's owner controls.
  3. Install with Anthropic's PowerShell installer instead of npm. In PowerShell, run irm https://claude.ai/install.ps1 | iex. The policy applies to script files and this installer runs the downloaded text directly, so it is not affected, and it installs a binary rather than a .ps1 script, into your own user folder. It changes no policy and needs no administrator, which makes it the permanent route on a machine whose policy you cannot change.

If the policy command answers that the policy was set by Group Policy, that option is closed to you: the .cmd launchers and the installer are the two that remain.

What does not help

  • Reinstalling anything with npm. The first failure can be npm's own launcher inside Node's folder, before Claude Code is installed at all, and reinstalling writes the same launcher files, so the same message comes back at the same point.
  • Editing npm.ps1. The policy is about the file being a script, so its contents do not change the outcome.
  • Setting an unrestricted policy for the whole machine. Anthropic's first solution is RemoteSigned for your user, not an unrestricted policy for the machine. A wider policy does clear the error, and it also removes a protection for every script the machine runs.
  • Typing claude in the window you just installed from. PowerShell may still resolve the old lookup. Open a new window first.

How do I know it is fixed?

  • Open a new PowerShell window and run claude --version: it prints a version number instead of the SecurityError.
  • After whichever fix you chose, run the install line again: it now reaches the end instead of stopping at the launcher.
  • On the policy route, Get-ExecutionPolicy -List shows RemoteSigned on the CurrentUser row, and plain Get-ExecutionPolicy reports it too. If the plain command reports something else, a higher row is overriding yours and the .cmd route or the installer is the answer.
  • On the .cmd route, no policy changed, and claude.cmd --version works where claude did not.

Where these answers come from

Common questions

Why does npm.ps1 say running scripts is disabled on this system?

PowerShell's execution policy is blocking the .ps1 launcher scripts that npm creates for its commands. The policy applies to script files, so npm's own command files are refused before they run, and claude.ps1 meets the same refusal after an npm install.

Does the PowerShell installer hit the same error?

No. Anthropic states the policy applies to script files, and the PowerShell installer runs the downloaded text directly, so it is not affected. It also installs a binary rather than a .ps1 script, which is why it is the permanent route on a machine whose policy you cannot change.

Do I need an administrator to change the policy?

Anthropic's first solution is Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser, which names your own user rather than the whole machine. Whether a machine permits that change is its owner's decision: on an employer-managed computer it may be refused. The .cmd launchers need no policy change, and the PowerShell installer needs neither the change nor an Administrator.

Is calling npm.cmd a real fix?

It is a workaround rather than a repair. Anthropic says npm.cmd and claude.cmd do the same job and the policy does not cover them, so they run where the .ps1 files do not. You type the suffix every time, and anything else on the machine that calls bare npm still meets the same error.