How to Resolve Error: ng.ps1 cannot be loaded because running scripts is disabled on this system
Hello Everyone!!!
If you are working with Angular ng commands and getting the error ng.ps1 cannot be loaded because running scripts is disabled on this system, this article may help you to resolve the issue.
Let’s start with how to fix the issue. Enjoy the article ….
Here I attached the error appearing when I am working with ng commands in my visual studio.
This error occurs due to security reasons. Without our approval, this would not let us execute the script in our system. This means that the system has disabled the running scripts and the system can’t accept the ng commands. Then what we can do to resolve this is open the PowerShell with administrative rights. To do this let’s follow these steps.
Step 01
Run the below command in the terminal.
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
After running this command you will see your terminal like below.
Now you are ready to go to step 02.
Step 02
As step 02 you have to run the below command in your terminal.
Get-ExecutionPolicy
After running this command your system will show a message like “RemoteSigned” as below image. If you get this message you will resolve the issue by following the coming steps.
Step 03
Step 03 is to view the list of policies which policy has been updated by the last commands. To view their policy next you need to run the below command in your terminal.
Get-ExecutionPolicy -list
Then you will see the list of policies in your terminal like in the below image.
Now you have successfully fixed the issue. To check that you can run ng commands and see whether they are working properly. To Check that here I run “ng version” command in the same terminal. Here is my output.
You can see that now ng command is working properly and the issue is now fixed.
Hope you enjoyed my article.
Happy Coding ……….
Thank you!