angularnpmyarnpkgangular10

Application installed by NPM (eg File C:\Users\name\AppData\Roaming\npm\ng.ps1) cannot be loaded because running scripts is disabled on this system


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?


Solution

  • 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/