Issue
In my Angular-12 Application, I tried to generate service using:
ng g s auth/services/login
but I got this error:
ng : File C:\Users\akweey\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 g s auth/services/login
+ ~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
When I checked the path: C:\Users\akweey\AppData\Roaming\npm\ng.ps1,
I only found ng but no ng.ps1
How do I get this resolved?
Thanks
Solution
This issue occurs due to undefined Execution policy.
Try this command in Powershell:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Answered By - Drashti Dobariya
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.