ng.ps1 cannot be loaded because running scripts is disabled on this system in vs code

When running the project you will see below error.

ng : File C:\Users\admin\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 s
+ ~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess

How to fix this ng.ps1

Solution 1

Open your angular project folder on Command line(CMD) and then run the below code.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 

Now run the project. I hope it works for you

Solution 2

You can try to do as below:

Remove ng.ps1 file from the directory C:/Users/admin/AppData/Roaming/npm/ng.ps1

Now run the project. I hope it works for you.

Imp:admin is your PC user name. Me be your PC user name is change.

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments