Node.js nodemon npm Module

Last Updated : 3 Jun, 2026

Nodemon is a development tool for Node.js that automatically restarts the application whenever project files are modified, making development faster and more efficient. Nodemon is commonly used as it:

  • Automatically restarts the server after file changes.
  • Reduces manual work during development.
  • Monitors project files continuously.

Installing nodemon

The module is installed globally using the following command:

npm install -g nodemon

After installing the module you can check the current version of the module by typing on console as shown below:

nodemon --version
Screenshot-2026-05-28-163701
nodemon version

Using nodemon

The nodemon wraps your application, so you can pass all the arguments you would normally pass to your app.

Syntax:

nodemon [your node app]

Example:

JavaScript
nodemon index.js

Output

Now everytime any changes are saved in this file, the nodemon triggers the automatic restart of Node application.

Key CLI Options

We have a list of options available for nodemon, that we can use. We can get that list using :

nodemon -h
Screenshot-2026-05-28-164033

where,

1. --watch:

Tells nodemon which specific file or folder to monitor. By default it watches the current directory, but you can narrow it down.

Syntax

nodemon --watch src app.js

Output

[nodemon] watching path(s): src/**/*
[nodemon] starting `node app.js`

2. --ext:

Defines which file extensions should trigger a restart. By default nodemon watches .js, .mjs, and .json. Use nodemon --ext js,ts,env to include additional types.

Syntax

nodemon --ext js,txt app.js

Output

[nodemon] watching extensions: js,txt
[nodemon] restarting due to changes...

3. --ignore:

Excludes certain files or directories from being watched. Useful for ignoring node_modules, log files, or test folders.

Syntax

nodemon --ignore logs app.js

Output

Changes inside logs/ will not restart the app

4. --delay:

Adds a wait time (in seconds) before restarting after a file change is detected. Helpful when multiple files save in quick succession.

Syntax

nodemon --delay 2 app.js

Output

[nodemon] delaying restart for 2 seconds
[nodemon] restarting due to changes...
Comment

Explore