Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to execute Angular CLI commands in Visual Studio Code terminal

I'm unable to execute Angular CLI commands in Visual Studio Code terminal. When I type ng --version in the terminal, it is opening the ng file instead of executing the command.

Any idea of how to resolve the above issue?

like image 742
user2636874 Avatar asked Feb 22 '19 04:02

user2636874


3 Answers

I had the same error in Windows. what I did is I set Command Prompt as the default shell Instead of PowerShell (PowerShell is default) in the terminal window where you select a terminal instance

like image 92
Alvinne James Barron Avatar answered Oct 12 '22 01:10

Alvinne James Barron


I got the following error message while executing ng serve from VSCode:

File C:\Users\\AppData\Roaming\npm\ng.ps1 cannot be loaded because running scripts is disabled on this system...

Solution:

I was able to solve the issue by running the following command in PowerShell:

set-executionpolicy remotesigned

Make sure to run PowerShell with admin privileges. More on this solution can be read here.

like image 19
dev Avatar answered Oct 12 '22 02:10

dev


The effective solution is

  1. opening the microsoft studio code by run as administrator
  2. set-executionpolicy remotesigned
  3. ng serve

It worked successfully.

like image 4
kripa Avatar answered Oct 12 '22 01:10

kripa