npm install --save [package-name] and
npm install --save-dev [package-name]. Both commands will lead to download and installation of packages from NPM servers but they have a bit different ways.
npm install [package-name] –save: When –save is used without -dev, it signifies that the package is core dependency. A core dependency is any package without which the application cannot perform its intended work. In package.json file under the dependencies section contains the list of core dependencies. The npm install will also lead to a similar result. When someone installs your package they will also install all the packages listed in the dependencies section of package.json. Example: express, body-parser.
npm install [package-name] –save-dev: When –save-dev is used with npm install, it signifies that the package is a development dependency. A development dependency is any package that absence will not affect the work of the application. In package.json file under the devDependencies section contains the list of all development dependencies. When someone installs your package they will not install any development dependencies but if they clone the repository, then they will install all the development dependencies too. Example: nodemon
|The package installed is core dependency.||The package installed is not a core rather development dependency.|
|All core dependency is listed under dependencies in package.json.||All development dependency is listed under devDependencies in package.json.|
|It will be installed if a third person tries to install or clone your package.||It will be installed if a third person tries to clone your package.|
|Example: express, body-parser etc.||Example: nodemon|
- Difference between NodeJS and AngularJS
- Nodejs | Automatic restart NodeJs server with nodemon
- Nodejs | DNS
- Nodejs | DNS | setServers()
- Nodejs | Jimp
- Web-Socket in NodeJS
- Nodejs | GM thumbnail() Function
- Nodejs | GM threshold() Function
- Nodejs | GM charcoal() Function
- Nodejs | GM drawCircle() Function
- Nodejs | GM drawEllipse() Function
- Nodejs | GM magnify() Function
- Nodejs | GM minify() Function
- Nodejs | GM write() Function
- Nodejs | GM operator() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.