I saw some tutorial where the command was:
npm install --save
What does the --save
option mean?
Not able to find the answer on Google.
node.jsnpm
I saw some tutorial where the command was:
npm install --save
What does the --save
option mean?
Not able to find the answer on Google.
Best Answer
Update npm 5:
As of npm 5.0.0, installed modules are added as a dependency by default, so the
--save
option is no longer needed. The other save options still exist and are listed in the documentation fornpm install
.Original answer:
Before version 5, NPM simply installed a package under
node_modules
by default. When you were trying to install dependencies for your app/module, you would need to first install them, and then add them (along with the appropriate version number) to thedependencies
section of yourpackage.json
.The
--save
option instructed NPM to include the package inside of thedependencies
section of yourpackage.json
automatically, thus saving you an additional step.In addition, there are the complementary options
--save-dev
and--save-optional
which save the package underdevDependencies
andoptionalDependencies
, respectively. This is useful when installing development-only packages, likegrunt
or your testing library.