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
This issue occurs due to undefined Execution policy.
Try this command in Powershell:
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
Just delete this file. C:\Users\username\AppData\Roaming\npm\ng.ps1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With