Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng serve not working in windows

I did an

npm i
npm -g @angular/cli

Then when I do

ng serve

I am getting this error

enter image description here

But I I put ng serve in npm script (npm start in package.json) it works.

like image 787
KRUSHANU MOHAPATRA Avatar asked Mar 06 '18 19:03

KRUSHANU MOHAPATRA


People also ask

Why ng serve command is not working?

To solve the error "ng: command not found", install the angular cli package globally by running npm install -g @angular/cli@latest and restart your terminal. If the command fails, run it with sudo and make sure the correct PATH is set in your system's environment variable.

Why is NG not recognized?

To solve the error "ng is not recognized as an internal or external command, operable program or batch file", install the angular cli globally by running npm install -g @angular/cli@latest and make sure your PATH environment variable is set up correctly.

How do I start ng serve?

To get the application running, the ng serve command must execute within the [name-of-app] folder. Anywhere within the folder will do. The Angular CLI must recognize that it is within an environment generated with ng new . It will run provided this one condition.

Why my ng serve take so long?

This is mostly because of bulky source map files. When you do ng serve , Angular serves the app from memory instead of the dist folder (the file system). This means the entire code (along with map files) will be loaded into the system's memory and this is the main reason why your system or IDE getting slow.


1 Answers

You need to install angular-cli and create a project using ng command.

You can follow the steps here

npm uninstall -g angular-cli @angular/cli
npm cache clean
npm install -g @angular/cli
like image 71
Sajeetharan Avatar answered Oct 13 '22 02:10

Sajeetharan