ng : File \AppData\Roaming\npm\ng.ps1 cannot be loaded. The file npm\ng.ps1 is not digitally signed Angular Error when running commands

Updated on: December 03, 2019

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

If you are running any angular command e.g. ng serve, ng build, ng new, ng generate etc. from Visual Studio Code Terminal or from command prompt and getting above error then you can go through the below solution to fix above issue.

Solution: Run the following command from the same terminal or command prompt and re-run the ng command to check if it works on your machine:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

After running above Set-ExecutionPolicy command, it should fix your digitally signed error of Powershell scripts for current logged in user. 

Know, what's causing this issue: Basically Powershell checks for it's execution policy while running Powershell scripts, so when it tried to execute ng.ps1 script, it checked for its current user's execution policy. You can check from the below command what is the execution policy is set currently:


If it is set to RemoteSigned, then it will give output of this above command as RemoteSigned. To get what are the ExecutionPolicy set currently, you need to run the below command:

Get-ExecutionPolicy -list

You can see from the above screenshot, CurrenteUser is set to RemoteSigned. If it is set to RemoteSigned, then you will not get error like ng.ps1 is not digitally signed. If it is set to AllSigned and the files are not digitally signed, then you will get the digitally signed error and you will not be able to run any ng command. If you want to set it back to AllSigned, then it can be done from following command:

Set-ExecutionPolicy AllSigned -Scope CurrentUser

If you are still not able to fix the above error using above solution, then first take a backup of \npm\ng.ps1 file and try deleting it temporarily and then re-run the ng command, later you can restore the deleted file after your testing.