Angular PowerShell ng.ps1 Can Not be Loaded and Not Digitally signed

watch_later 17 November, 2021

In this article, I am going to explain how to fix the error The file C:\Users\admin\AppData\Roaming\npm\ng.ps1 is not digitally signed.

I working with an angular application and recently when I compiled and run my angular application using ng s --open Powershell command, I got the following error:

ng: File C: \Users\admin\AppData\Roaming\npm\ng.ps1 cannot be loaded.The file C: \Users\admin\AppData\Roaming\npm\ng.ps1 is not digitally signed.
You cannot run this script on the current system.
For more information about running scripts and setting execution policy,
see about_Execution_Policies at https: /go.microsoft.com/fwlink /? LinkID = 135170.
At line: 1 char: 1
   + ng s--open
   + ~~
   + CategoryInfo          : SecurityError: (:)[], PSSecurityException
   + FullyQualifiedErrorId : UnauthorizedAccess

This error indicates that your device is stopping you from executing or running the script files. Implementation of those regulations takes place on Windows systems inclusive of Windows client or Windows Server machines. 

Angular PowerShell ng.ps1 Can Not be Loaded and Not Digitally signed

The PowerShell has the following execution policies, formatting, and configuration files which have (.ps1xml) file extension, module script files which have (.psm1) file extension and PowerShell profiles have a (.ps1) file extension.

I have searched many solutions for the same over the internet but most of the solutions did not work for me and finally, I got the solution to fix this error that I wanted to share with you. You can follow the given steps to fix the angular PowerShell error.

In my previous articles, I explained many topics on create angular project, crud in angular, charts in angular, angular with bootstrap, angularJS, Microsoft excel upload and etc, that you might like to read.

Implementation

So, let's start with a solution for this error.

Step 1: Open the PowerShell window with the administrative rights and then execute the following command.

Get-ExecutionPolicy -List
PowerShell-ExecutionPolicy

As you can see in the Execution Policy list, there is a CurrentUser marked as Undefined as well as LocalMachine is defined as Restricted, So we have to fix it and mark them as AllSigned.

Step 2: Now, execute the following command in the PowerShell window.

Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope CurrentUser
PowerShell-ExecutionPolicy-CurrentUser


Set-ExecutionPolicy -ExecutionPolicy AllSigned -Scope LocalMachine
PowerShell-ExecutionPolicy-LocalMachine


Step 3: When you again execute the following command, you can see the CurrentUser and LocalMachine marked as AllSigned and the issue has been resolved. Now you can run your angular application without any error.

PowerShell ExecutionPolicy

Summary

In this article we learned, way to fix PowerShell ng.ps1 can not be loaded and not digitally signed related error for angular application as well as we learn PowerShell ExecutionPolicy and their states and PowerShell command for the change it.

Let me know if you still facing any errors, I will help you. You can drop your comments or you can directly contact me by visiting the contact us page.

Codingvila provides articles and blogs on web and software development for beginners as well as free Academic projects for final year students in Asp.Net, MVC, C#, Vb.Net, SQL Server, Angular Js, Android, PHP, Java, Python, Desktop Software Application and etc.

Thank you for your valuable time, to read this article, If you like this article, please share this article and post your valuable comments.

Once, you post your comment, we will review your posted comment and publish it. It may take a time around 24 business working hours.

Sometimes I not able to give detailed level explanation for your questions or comments, if you want detailed explanation, your can mansion your contact email id along with your question or you can do select given checkbox "Notify me" the time of write comment. So we can drop mail to you.

If you have any questions regarding this article/blog you can contact us on info.codingvila@gmail.com

sentiment_satisfied Emoticon