I'm learning basic node.js and realized that I can use a package installed globally on my pc without installing it in my project.
Currently my dependencies look like this:
"dependencies": {
"cookie-parser": "~1.4.4",
"debug": "~2.6.9",
"express": "~4.16.1",
"http-errors": "~1.6.3",
"morgan": "~1.9.1",
"pug": "2.0.0-beta11"
},
"devDependencies": {
"jasmine": "^3.6.1"
}
I was using nodemon but just realized that it's not listed as a dev dependency, should I add it with npm i --save-dev nodemon as a good practice?
I guess it must be declared as dependency in case this was a collaborative project but I'm not sure.
When performing a local installation, you can install nodemon as a dev dependency with --save-dev (or --dev ). Install nodemon locally with npm : npm install nodemon --save-dev.
Install Nodemon I assume you have Node. js and NPM installed. You can install Nodemon on your machine, globally, or locally on your project using NPM.
When working locally on a NodeJS project, nodemon is required in order to make the coding easier.
If you install nodemon as a Dev dependency, then it will not be locally installed, it'll not be available in your system path. But if you install nodemon globally then it'll be installed on your system path globally.
To install nodemon globally:
npm install -g nodemon
To install nodemon as a dev dependecy:
npm install --save-dev nodemon
Thanks!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With