1. Open up Windows Powershell as Administrator
  2. Run the following command: set-executionpolicy remotesigned
  3. You should be able to now run commands in the Visual Studio Code terminal for Angular and Node.js.


I was trying to create my first Angular project using Visual Studio code, I successfully got the Angular CLI installed alongside Node.js. But when I tried to run the command ng new (also errors for ng serve command) I was met with the following error message:

ng : File C:\Users\AppData\Roaming\npm\ng.ps1 cannot be loaded. The file C:\Users\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:/
At line:1 char:1
+ ng new
+ ~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

I was able to resolve this error message by opening Windows Powershell as Administrator and then running the following command:

set-executionpolicy remotesigned

This error is thrown because Windows does not want just any random powershell script to run on your machine. For more information about this command please read Microsoft's Article - About Execution Policies.

Additional Links that may be helpful:

StackOverflow - Powershell does not run Angular Commands

Thanks for reading and I hope this solution helped you out when setting up your first Angular project in Visual Studio Code.


FeedbackI'd love to hear your feedback!
Did this blog post help fix your issue? Still having trouble?
Tweet At Me
Brendan SlukeSoftware Engineer

Hi, I'm Brendan Sluke and I love writing code and blogging about software engineering.

Follow Me On Twitter Read My Blog
Recommended Blog PostsBlog Posts I Think You Will Find Interesting
Go Back To Top of Page