Nodemon All The Projects!

Jim Morrison
Sep 3, 2018 · 2 min read

As time has marched on, I’ve noticed a couple different things I do repeatedly when starting a new node.js project. One is checking my npm version before I create the new project. The second is adding nodemon to the app immediately after I successfully run npm init. It’s a useful tool to always keep in your developer tool belt as you charge through your GIT commits!

What is Nodemon?

Nodemon is a package that watches for local development environment changes in your node.js project and when it sees one made, it restarts the local instance to pull in the changes automatically.

It was initially created by Remy Sharp, who’s based out of Brighton, UK where he runs his own business called Left Logic! The project is open source and has had 119 contributors on the github project to date.

What are all the benefits?

Remy and crew really did a great job of breaking down the full list of benefits of this tool on the Nodemon website which looks like:

  • Automatic restarting of application.
  • Detects default file extension to monitor.
  • Default support for node & coffeescript, but easy to run any executable (such as python, make, etc).
  • Ignoring specific files or directories.
  • Watches specific directories.
  • Works with server applications or one time run utilities and REPLs.

How Do I Add It To My Node Project?

Adding nodemon to your project globally is as simple as:

npm install -g nodemon

Now in your terminal you can run the command below to enjoy joys of auto refresh:

nodemon [Your APP]

What’s That? You Rather Have It As A Dev Dependency?

You can include nodemon as a dev dependency as easy as pie:

npm install --save-dev nodemon

However, keep in mind that you will need to run it through a npm script within your package.json. It may look like this:

"scripts": {
"startdev": "./node_modules/nodemon/bin/nodemon.js app.js"
}

Which means to run the above script it would be:

npm run startdev

This will run nodemon from your packages in which you can see a confirmation populate in terminal that it’s running like below:

[nodemon] 1.18.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`

Overall Thoughts

I’ve found time and time again nodemon brings value to my development experience and projects through saving me time, stopping and starting the project locally, as I work on crafting changes to the project. I highly recommend giving it a shot in your next or existing node app.

Also be sure to check out the Nodemon.io website and their documentation at their GitHub repo!

Thanks for reading my article! If there is something you’d love to see me write or talk about, throw me a line on Twitter, Instagram, Medium, LinkedIn, or my new Youtube channel!

Jim Morrison

Written by

A caffeinated Web Developer. Content Creator. Community Engineer @ Auth0.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade