Solution
- Open up Windows Powershell as Administrator
- Run the following command:
set-executionpolicy remotesigned
- You should be able to now run commands in the Visual Studio Code terminal for Angular and Node.js.
Backstory
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:
|
|
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.
-Brendan