Monday, July 6, 2020

Powershell: ng.ps1 cannot be loaded because running scripts is disabled on this system.

https://stackoverflow.com/questions/58032631/why-powershell-does-not-run-angular-commands

Problem:
PS D:\angular\my-dream-app> ng serve --host 0.0.0.0
ng : File C:\Users\arthu\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system. For more
At line:1 char:1
+ ng serve --host 0.0.0.0
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

Solution:

Remove ng.ps1 from the directory C:\Users\%username%\AppData\Roaming\npm\ then try clearing the npm cache at C:\Users\%username%\AppData\Roaming\npm-cache\

No comments:

Post a Comment