Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Possible to install all missing modules for a node application?

Tags:

node.js

npm

I have a node app that I just started working with and each time I try to run it, it says there is a missing module. I've just been using npm install ... for each module but after doing about 10 of them I'm wondering if there is a way to have npm pull down all needed modules for a node app without me installing each one manually. Can it be done?

like image 593
Abe Miessler Avatar asked Nov 02 '12 04:11

Abe Miessler


People also ask

How do I install all node modules for a project?

It's simple. If you want to install all the node_modules from the package. json file you simply put: npm install in terminal (on the same directory where the package. json exists) and it would install all the node modules in the folder called node_modules .

How do I reinstall node modules globally?

To install a module from npm globally, you'll simply need to use the --global flag when running the install command to have the module install globally, rather than locally (to the current directory). Note: One caveat with global modules is that, by default, npm will install them to a system directory, not a local one.


2 Answers

Yes, as long as the dependency is listed in package.json.

In the directory that contains package.json, just type:

npm install 
like image 189
JP Richardson Avatar answered Sep 28 '22 19:09

JP Richardson


I created an npm module to handle installing missing modules automatically.

npm-install-missing

It will install all app dependencies and sub-dependencies automatically. This is useful when submodules aren't installed correctly.

like image 39
alexcline Avatar answered Sep 28 '22 21:09

alexcline