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
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,
- RemoteSigned
- 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
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
Finally, you shall be all set to run your script (without restarting the PowerShell).
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.
Thanks for this info, is there another way to do this with digital signatures that might be available if security is a concern
Thanks it worked like magic
Hello Navjot- Glad it helped you!
That’s great !!
It worked like magic 🙂
Hey Gaurav, Thank. Glad it helped you !