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?
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.
npm install does not create node_modules folder and not downloading any dependencies.
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).
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With