node_modules appears empty, you may need to run `npm install`

karunakar bhogyari picture karunakar bhogyari · Nov 3, 2017 · Viewed 26k times · Source

I have cloned an Angular 4 project from git.

When I go to the root folder of the project and executed ng serve.

I am getting following error:

node_modules appears empty, you may need to run `npm install`

How can I fix the above error?

Answer

Chris Sharp picture Chris Sharp · Nov 3, 2017

Run npm install from the root of the project. If you're on a mac then you may want to run sudo npm install in case some if the package installations require elevated permissions. If it has submodules then leave a comment below and I'll update this answer to include how to deal with those. No use in confusing this answer with that unless you hit it.