Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to npm install --save all packages already installed?

Tags:

npm

Is there a way I can update package.json from node_modules directory? Sometimes I forget to use --save flag.

Thanks!

like image 795
TLJ Avatar asked Aug 21 '14 05:08

TLJ


People also ask

Does npm install install all packages?

By default, npm install will install all modules listed as dependencies in package. json . With the --production flag (or when the NODE_ENV environment variable is set to production ), npm will not install modules listed in devDependencies .

How do I save a package in npm?

–npm install --save or -S: When the following command is used with npm install this will save all your installed core packages into the dependency section in the package. json file. Core dependencies are those packages without which your application will not give the desired results.

How npm install and save?

If you are using a recent version of npm save yourself from unnecessary typing and use npm install [Package Name] instead of npm install [Package Name] --save by default it will add the installed package to the dependency list in the package. json file.

How do I prevent npm install from removing packages?

To Save : npm install --save {package_name} . This will save the package to package. json and install using npm install . You can't particularly control the dependencies(fully).


Video Answer


1 Answers

I came up with this simple cmd

npm install `ls node_modules` --save

It's good enough for my case :-)

like image 118
TLJ Avatar answered Sep 21 '22 15:09

TLJ