Registry / devops / nodemon

nodemon

JSON →
library0.1.2jsnpmunverified

Nodemon is a utility that monitors for changes in your Node.js application files and automatically restarts the server, streamlining the development workflow. It acts as a wrapper for your Node.js application, requiring no code changes. The current stable version is 3.1.14, and it maintains an active release cadence, primarily issuing bug fixes and type definition updates.

npm install nodemon
INSTALL
IMPORT
SIG · NODEMON
N
nodemon
devopsjavascriptv0.1.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

nodemon
import nodemon from 'nodemon';
const nodemon = require('nodemon');
While primarily a CLI tool, nodemon can be used programmatically. `import` is preferred for modern Node.js projects, especially with type support. CommonJS `require` can also work for older projects, but ESM is generally recommended.
restart
import { restart } from 'nodemon';
import nodemon, { restart } from 'nodemon';
Specific functions like `restart` might be exposed as named exports. Check the official API documentation for all available programmatic exports. Attempting to destructure `restart` directly from the default export `nodemon` will likely fail.
Nodemon CLI
npx nodemon my-app.js
import 'nodemon';
Nodemon is most commonly used as a command-line tool. If installed locally, use `npx nodemon` or define it in your `package.json` scripts. Importing it without assigning to a variable in module code has no effect.

This demonstrates how to set up `nodemon` as a development dependency in a `package.json` file and run a simple Express application. When you run `npm run dev`, nodemon will start the server and automatically restart it whenever `src/index.js` (or other watched files) change. The server will display a changing timestamp on each reload.

{ "name": "my-node-app", "version": "1.0.0", "description": "My sample app", "main": "src/index.js", "scripts": { "dev": "nodemon src/index.js", "start": "node src/index.js" }, "devDependencies": { "nodemon": "^3.0.0" } } // src/index.js const express = require('express'); const app = express(); const PORT = process.env.PORT ?? 3000; app.get('/', (req, res) => { res.send('Hello from Nodemon! Last updated: ' + new Date().toLocaleTimeString()); }); app.listen(PORT, () => { console.log(`Server running on http://localhost:${PORT}`); });
nodemon --version
Debug
Known issues
gotchaNodemon's file watching might not work as expected on Windows in versions prior to 3.1.14.
fix
Upgrade to nodemon v3.1.14 or newer to ensure stable file watching on Windows.
affects: <3.1.14
gotchaWhen installing nodemon, choose between global (`npm install -g nodemon`) or local (`npm install --save-dev nodemon`). Global installations add `nodemon` to your system path, while local installations require `npx nodemon` or a `package.json` script to run.
fix
For project-specific development, prefer a local installation (`npm install --save-dev nodemon`) and run it via `npx nodemon` or an `npm run` script. This ensures consistent versions across developers and environments.
affects: >=1.0.0
gotchaNodemon respects `nodemon.json` configuration files (local and global) and command-line arguments. Command-line arguments always take precedence over local config, which in turn overrides global config.
fix
Be aware of the configuration hierarchy. If a setting isn't working, check if it's being overridden by a more specific configuration source.
affects: >=1.0.0
gotchaIf your Node.js script exits cleanly, nodemon will automatically restart it only if file changes are detected. It will not keep the process alive indefinitely if the script finishes its execution.
fix
This is expected behavior for scripts that aren't long-running servers. If you expect a script to stay alive, ensure it has an active process (e.g., an HTTP server listening). If you need to manually restart, type `rs` and press enter in the terminal running nodemon.
affects: >=1.0.0
gotchaNodemon uses default ignore patterns (e.g., `.git`, `node_modules`). If files you expect to be watched are ignored, or if too many files are watched, performance can suffer.
fix
Customize `watch` and `ignore` options in your `nodemon.json` or via command-line arguments to precisely control which files and directories nodemon monitors. For example, `nodemon --ignore 'dist/'` or `nodemon --watch 'src/'`.
affects: >=1.0.0
breakingNodemon versions prior to 3.1.7 might have had less robust TypeScript type definitions, especially for ES Module exports.
fix
Upgrade to nodemon v3.1.7 or newer to benefit from improved TypeScript types and ES Module export definitions, ensuring better type checking and module interoperability.
affects: <3.1.7
Errors
Common errors & fixes
'nodemon' is not recognized as an internal or external command, operable program or batch file.
Nodemon is not installed globally or is not in your system's PATH, and `npx` is not being used.
fix
If installed locally (`npm install --save-dev nodemon`), run it using `npx nodemon` or define a script in `package.json` like `"dev": "nodemon index.js"`. Alternatively, install it globally: `npm install -g nodemon`.
nodemon: command not found
Nodemon is not installed globally or is not in your system's PATH, and `npx` is not being used.
fix
If installed locally (`npm install --save-dev nodemon`), run it using `npx nodemon` or define a script in `package.json` like `"dev": "nodemon index.js"`. Alternatively, install it globally: `npm install -g nodemon`.
[nodemon] app crashed - waiting for file changes before starting...
Your Node.js application encountered an unhandled error and crashed.
fix
Review the error output immediately preceding this message (it will be from your application, not nodemon) to identify and fix the bug in your code. Nodemon is simply reporting that your application failed.
[nodemon] clean exit - waiting for changes before restart
Your Node.js application exited successfully (e.g., a script completed its task, or a server gracefully shut down).
fix
This is often not an error, but expected behavior. Nodemon will restart the application if any monitored files change. If your application is a server, ensure it's continuously listening for requests, otherwise it will exit cleanly.
Error: Cannot find module 'path/to/your/script.js'
The path provided to nodemon for your application's entry point is incorrect or the file doesn't exist.
fix
Double-check the file path. Ensure it's relative to where you're running the `nodemon` command, or provide an absolute path. For example, `nodemon ./src/app.js`.
Upgrade
Version history
0.1.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
nodemon — npm install nodemon · libregistry