Search⌘ K

Install Nodemon

Explore how to install and use Nodemon to automatically restart your Node.js server when code changes are detected. This lesson helps you configure Nodemon globally, update npm start scripts, and optimize development workflows by ignoring specific folders like /db, allowing seamless Express app development.

Notice that we’re manually restarting the server every time we make a code change, which is too time-consuming.

Nodemon

Enter Nodemon, a development tool that monitors Node.js applications and automatically restarts the server whenever it detects file changes.

  1. Install the nodemon package globally:
Shell
npm install -g nodemon

A global installation is performed using the -g flag. Installing a package globally allows it to be used across all Node.js applications. The package won’t be included in the project dependency; instead, it will be installed in a global location on the machine.

The npm root -g command will tell where that exact location is on the respective machine.

On macOS or Linux, this location could be /usr/local/lib/node_modules.

On Windows, it could be ...