Saturday, 29 April 2017

Why wouldn't you want to use the `--save` option for npm install?

I read about using the --save option here and and it says that it will add the installed package to your package.json file. But why isn't this automatic? Wouldn't you always want this? My understanding is that the node_modules is the directory that actually holds the code of your package and package.json is the reference/list of all the packages you have installed so that when you push it up to a repo, you only push the latter up and not the former, to save space. Then when other people clone or fork off your repo, they will have the package.json to reference and install all the necessary packages to work off of your project. Thus, wouldn't you always want your packages to be in the package.json in order for everyone to get what is needed?



via stackjlei

No comments:

Post a Comment