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?
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?
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.
npm install
or sudo npm install
wasn't working. The key is to sudo rm -rf node_modules/
FIRST, then npm install
will work fine. Make sure to sudo
remove –
Cabrera If it's saying node_module is empty
, it means it's not getting the path.
First of all, check the path. Go to that path using the cd
command, such as:
cd C:\Windows\UrProjectName
After that, run ng serve
in node using the Command Prompt (Windows).
ng new
. I needed to change to the newly created project directory before calling ng serve
–
Weasel Open the directory where your project is using:
cd Project_Name
Then, run the following command:
npm install
After that, you can then easily run the ng g component
command.
In this situation you should right click the app.component.html
module, then click "open in terminal".
After the terminal is opened at the bottom, all you need to do is type the following command:
ng serve
It should now work properly. Every time you run the project and use this method, you will be able to avoid these types of errors.
© 2022 - 2024 — McMap. All rights reserved.