Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to rebuild node modules with npm?

I'm a complete beginner at Node so maybe my question is probably very naive, sorry about that.

I created my first project at work with Grunt.

Grunt uses Node, so now I have a nice folder node_modules at the root of my project, with several modules inside. Everything is working fine.

I added node_modules/* in my .gitignore, assuming that I would rebuild it easily from another place.

Then I go home, I retrieve my project with git and now I don't know how to rebuild the node modules.

Is there an npm command that would read package.json?

like image 778
Vivien Adnot Avatar asked Apr 11 '16 09:04

Vivien Adnot


People also ask

What is the npm rebuild command for?

The npm-rebuild command will run npm build command on the matched folders. This command is particularly useful when you install a new version of node, and you have to recompile all your C++ addons with the new binary. This command opens a package repository page in the browser.

How do I clean and reinstall node modules?

There are two ways to clean up the node_modules folder: Delete the folder and reinstall. Use npm prune (starting with npm version 6)


1 Answers

Try npm i, a short version of npm install inside your directory where package.json exists.

like image 128
Eye Avatar answered Sep 24 '22 08:09

Eye