Installation of expressJS using npm

What’s the difference between these What does –save do in the command

$ npm install express –save

$ npm install express

Answer

When installing a module using npm the --save option saves the module name and version to the package.json file. It is the default and the module will be saved event without the parameter. Having the modules listed in the package.json file allows you to install all the needed modules for a project using npm install

It should be mentioned that this saves a runtime dependency. If there is a module which is only used during development (e.g. nodemon) you install it using --save-dev so it is saved as a development dependency. Check the link above for all the npm options

Leave a Reply

Your email address will not be published. Required fields are marked *