PASSWORD RESET

Your destination for complete Tech news

What is the –save option for npm install?

501 0
< 1 min read

The --save option for npm install is used to save the installed package as a dependency in the package.json file of the project.

By default, npm install installs a package in the local node_modules directory, but does not update the dependencies section of the package.json file. This means that the installed package will not be listed as a dependency of the project, and it will not be included when the project is published or when another developer installs the project’s dependencies.

To save the installed package as a dependency of the project, you can use the --save option when running npm install. For example:

npm install express --save

This will install the express package in the local node_modules directory, and it will also update the dependencies section of the package.json file to include express as a dependency.

You can also use the --save-dev option to save the package as a development dependency, which is useful for packages that are only needed during development, such as testing frameworks or build tools.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.