Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

angular

serve

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?

like image 437
karunakar bhogyari Avatar asked Nov 03 '17 14:11

karunakar bhogyari


People also ask

Why is my node_modules empty?

This error happens when there are missing packages in your node_modules/ folder that prevents the development server from running. To solve this error, you need to make sure that you have the node_modules/ folder generated by the npm install command.

Does npm install make node_modules?

npm install does not create node_modules folder and not downloading any dependencies.

Why npm install is not working?

If your npm is broken: On Mac or Linux, reinstall npm. Windows: If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer (see this note about installing the latest stable version).

How do I force an NPM package to install?

Run npm update -g npm. Execute this command by running the command prompt as Administrator npm install -g windows-build-tools. Run npm install inside the project folder where the package. json file is located, if it doesn't work run: npm install --force.


1 Answers

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.

like image 63
Chris Sharp Avatar answered Sep 18 '22 15:09

Chris Sharp