Angular Powershell ng.ps1 cannot be loaded and not digitally signed

Today in this article on issue resolution, we will see how to fix the common issue like ng.ps1 cannot be loaded and not digitally signed.

We will cover below aspects,

Issue Description

Angular commands like ng new or ng serve produce PowerShell commands error as below,

ng : File C:\Users\test\AppData\Roaming\npm\ng.ps1 cannot be loaded. The file C:\Users\test\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

ngps1 cannot be loaded

Resolution

This issue means your machine is preventing you from running script files.

Implementation of these policies occurs on Windows platforms including Windows client or Windows Server machines.

The PowerShell execution policies are as follows,

  • AllSigned
  • Bypass
  • Default
  • RemoteSigned
  • Restricted
  • Undefined
  • Unrestricted

Steps to resolve the issue

To change the PowerShell execution policy on your Windows computer, use the below command

Step1: Get-ExecutionPolicy for your Machine

 Get-ExecutionPolicy -List

ngps1 cannot be loaded

Step 2: Set Execution Policy

Once your identity scope and execution policy, please run the below commands using the same.

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Angular Powershell ngps1 can not be loaded and not digitally signed

Finally, you shall be all set to run your script (without restarting the PowerShell).

Angular Powershell ngps1 can not be loaded and not digitally signed

Do you have any comments or ideas or any better suggestions to share?

Please sound off your comments below.

Happy Coding !!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



34 thoughts on “Angular Powershell ng.ps1 cannot be loaded and not digitally signed

  1. Thanks for this info, is there another way to do this with digital signatures that might be available if security is a concern

Leave a Reply

Your email address will not be published. Required fields are marked *