ng serve throws node_modules appears empty error

Viewed 11633

I just started learning Angular 4, and as part of learning process i did the following:

Install Node.js (version 8).

Ran this command npm install -g @angular/cli

created a new project through CLI: ng new my-first-app

As soon as i ran this command: ng serve, i got an error node_module appear empty, you may need to run 'npm install'. Once i run npm install, it installed a few libraries and now ng serve builds and runs the project. i am trying to understand why did i need to npm install and what did it install? shouldn't all the prerequisites have been installed with this command npm install -g @angular/cli

3 Answers

When you create an angular app from terminal

ng new my-first-app

you usually be one folder level up in the terminal. Navigate to your project path

cd my-first-app

and run

npm install

it should get resolved.

Related