Sitemap
Thisharika Rangani

Thisharika Rangani

Why Do We Use npm install --save-dev nodemon in Node.js?

2 min readJun 21, 2026

--

Press enter or click to view image in full size

If you’re starting with Node.js, one command appears very early in tutorials and projects:

npm install --save-dev nodemon

At first glance, it may seem like just another package installation.

But once you understand what nodemon does, it quickly becomes one of those tools you don’t want to develop without.

The Problem Without Nodemon

Imagine you start your Node.js application:

node server.js

Output:

Server running...

Now you update your code:

Before:

console.log("Hello");

After:

console.log("Hello Updated");

Nothing changes automatically.

You must manually restart the server every time:

CTRL + C
node server.js

If you’re making lots of small changes, repeating this becomes slow and annoying.

What Nodemon Does

Nodemon watches your files and automatically restarts your server whenever changes are detected.

Install it:

npm install --save-dev nodemon

Add a script to package.json:

{
"scripts": {
"dev": "nodemon server.js"
}
}

Run:

npm run dev

Output:

[nodemon] starting `node server.js`
Server running...

Now edit your code:

console.log("updated");

Save the file.

Get Thisharika Rangani’s stories in your inbox

Join Medium for free to get updates from this writer.

Nodemon automatically does:

[nodemon] restarting...

No manual restart required.

Why Use --save-dev?

You’ll often see this installation command:

npm install --save-dev nodemon

The --save-dev flag means:

Install this package only for development.

That’s because nodemon is not needed in production.

After installation, package.json updates like this:

{
"devDependencies": {
"nodemon": "^3.x"
}
}

Example project:

{
"dependencies": {
"express": "^5.x"
},
"devDependencies": {
"nodemon": "^3.x"
}
}

Difference:

  • dependencies : Required for the application to run
  • devDependencies: Required only during development

Typical Node.js Setup

Install runtime dependency:

npm install express

Install development dependency:

npm install --save-dev nodemon

package.json

{
"scripts": {
"dev": "nodemon server.js",
"start": "node server.js"
}
}

Use:

npm run dev

→ During development

Use:

npm start

→ In production

Final Thoughts

Nodemon doesn’t make your application faster.

It makes you faster.

By automatically restarting your server after changes, it removes repetitive manual work and creates a smoother development experience.

That’s why nodemon is one of the first tools many Node.js developers install.

Small tool. Big productivity boost.

--

--