isrcca
Last Updated: July 12, 2016
·
11.33K
· calamari
6b4b7f11163b1e87571995ce8c3f0bce

Install npm packages with --save or --save-dev

I am not quite sure since when npm has this arguments and why I missed that, but they are really great.

If you npm install something with --saveor --save-dev, it will not only install it, it will also put it in the right place within your package.json file.

So, go ahead and try for example this one:

npm install express --save 

And you will see it put "express": "~3.4.4" at the end of the dependencies block within your package.json. It will always use the ~ notation with the full version number, so you will not have problems reinstalling the same version again on different systems.

Or put the dependcy into the devDependenciessection:

npm install supertest --save-dev

If you write a new application and are trying out differnt npm packages, it really is a time safer.

Say Thanks
Respond