Saturday, 21 April 2018

node_modules appears empty, you may need to run `npm install` when you run ng server --open in Angular CLI.

In this article, We will discuss about node_modules appears empty, you may need to run `npm install` when you run ng server --open in Angular CLI.

Whenever you will create new Project in Angular CLI with "ng new Proj1", then at that time automatically it will create node_modules folder and it will automatically install all the required packages in it.

But when you run "ng server --open", it will show error like node_modules appears empty, you may need to run `npm install` because it is not getting the proper path .

So first of all, we need to Check the path, that is whether we are inside of that project or not in command prompt and then we need to type "ng server --open".

Example:-
---------
Let's Say We created a new Project "AngularApp1" under D:\MyProject\ by using "ng new AngularApp1".

But while running the project, i am inside D:\MyProject\ in command prompt and running with ng server --open then at that time in MyProject it is trying to find out node_modules folder but which is not present. Rather than it is present under "D:\MyProject\AngularApp1" folder.

So Now, In Command prompt we need to switch to "D:\MyProject\AngularApp1" and type ng server --open and which will work fine.

0 comments:

Post a Comment