26

When running commands installed by npm (i.e. yarn, ng, etc.), I receive the following error:

File C:\Users\<username>\AppData\Roaming\npm\<application> cannot be loaded because running scripts is disabled on this system.

where <application> is one of the commands installed by npm (i.e. yarn, ng, etc.)

How can this issue be resolved?

RobC
  • 22,977
  • 20
  • 73
  • 80
Esraa Alattar
  • 1,141
  • 1
  • 7
  • 9

1 Answers1

88

I just try this command in VS terminal(PowerShell) and my problem has been solved

Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

note : don't change CurrentUser to your username
edit : you can follow this link for changing the visual studio code terminal to cmd.exe instead of PowerShell and it will work without any security issues. https://blog.jongallant.com/2017/02/vs-code-integrated-terminal-powershell-default-change-to-cmd/

Esraa Alattar
  • 1,141
  • 1
  • 7
  • 9