ng : File C:\Users\Dell\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system.

 Problem is 

I have started to learn Angular but I note that powershell in Windows gives me an error whenever I make an angular command like:

ng new new-app

or

ng serve

this is the error what I got:

ng : File C:\Users\< username >\AppData\Roaming\npm\ng.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.
At line:1 char:1
+ ng serve
+ ~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess




solution is 
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\

and It working . Thank's.

1 Comments

Thank you

Previous Post Next Post