Guide · Open source
How to use nodemon: install, run and configure it
Updated · written with AI from the project's own documentation and checked against our catalogue data
nodemon is a command-line tool that watches the files in your Node.js project and restarts the application when they change. This guide is for developers who want faster edit-and-reload cycles while building a local server or script. By the end you will be able to install nodemon, run your app through it, and set up a config file to control what gets watched and ignored.
Quick start
- 1Install nodemon. Run npm install -g nodemon for a global install, or npm install --save-dev nodemon inside your project.
- 2Replace node with nodemon. Start your script with nodemon instead of node, passing any arguments your app needs.
- 3Edit a watched file. Save a change to a watched file, such as a .js file, and nodemon restarts the app automatically.
- 4Restart by hand if needed. Type rs and press enter while nodemon runs to restart without quitting nodemon.
- 5Add a nodemon.json file. Create nodemon.json in your project or home directory to set options like ignore, ext or execMap.
- 6Ignore noisy files. Use --ignore or the ignore key to stop test files or other paths from triggering restarts.
Install nodemon with npm
You need Node.js and npm or yarn. The README recommends npm for installation. You can install nodemon globally so it is on your system path.
- Global install, available from any directory
npm install -g nodemonAdd nodemon to a project as a dev dependency
You can also install nodemon as a development dependency in a specific project. A local install is not on your system path, so run it from an npm script such as npm start, or with npx nodemon.
npm install --save-dev nodemonRun your app with nodemon instead of node
nodemon does not require any changes to your code or way of working. It is a replacement wrapper for node: replace the word node on the command line with nodemon. Any arguments you would normally pass to your app still work. Output from nodemon is prefixed with [nodemon], and everything else your app prints, errors included, is shown as usual.
nodemon ./server.js localhost 8080Restart manually and use inspect
While nodemon is running, you can type rs and press enter to restart your process without stopping nodemon. You can also pass node flags such as --inspect through the command line.
- Type rs then press enter to restart manually
- Pass node options before your script, for example --inspect
nodemon --inspect ./server.js 80Configure nodemon with nodemon.json or package.json
nodemon supports local and global configuration files, usually named nodemon.json, in the current working directory or your home directory. You can also point to another file with --config <file>. Command line arguments override config file settings, which override the local config, which overrides the global config. You can also place settings under nodemonConfig in package.json, but a local nodemon.json or a --config file causes package.json config to be ignored.
- Command line arguments take priority
- Then local config (nodemon.json)
- Then global config
{
"verbose": true,
"ignore": ["*.test.js", "**/fixtures/**"],
"execMap": {
"rb": "ruby",
"pde": "processing --sketch={{pwd}} --run"
}
}Watch specific folders, extensions and ignore files
By default nodemon watches the current working directory and looks for .js, .mjs, .coffee, .litcoffee and .json files. Use --watch to limit watched paths, -e (or --ext) to set the extensions, and --ignore to skip files or patterns. Quote glob patterns. Ignore patterns match the full absolute path, so use ** for wildcards, for example '**/test/**'. nodemon ignores .git, node_modules, bower_components, .nyc_output, coverage and .sass-cache by default.
- --watch app --watch libs watches only those paths
- -e js,pug sets the extensions to watch
- --ignore lib/ skips a directory
nodemon --watch app --watch libs app/server.jsRun non-JavaScript scripts
nodemon can run and monitor other programs. Use --exec to name the program, and nodemon will watch files with that script's extension. For languages nodemon does not support by default, add an execMap entry in nodemon.json. The README suggests keeping execMap in the global config.
nodemon --exec "python -v" ./app.pyWhat people use it for
- Restart a local Node.js web server each time you save a route or template change
- Watch a Python or Ruby script by mapping its extension with execMap
- Run a Node.js script while you learn, so edits show up immediately
- Keep one shared nodemon.json so a team uses the same watch and ignore rules
Frequently asked questions
Is nodemon free to use?
nodemon is released under the MIT licence, according to the project listing. You can use it, and the licence terms are in the project's repository.
Do I need to change my code to use nodemon?
No. The README says nodemon does not require any additional changes to your code or method of development. You just replace the word node with nodemon when you run your script.
How do I install nodemon?
The README recommends npm. Use npm install -g nodemon for a global install, or npm install --save-dev nodemon for a project dependency. Yarn commands are also given in the README.
Can I use nodemon in production?
The project presents nodemon as a development tool, and its description says it is perfect for development. For production, use a process manager or a plain node start, as the source does not cover production use.
Why does nodemon not restart when I change a file?
By default nodemon only watches .js, .mjs, .coffee, .litcoffee and .json files in the current directory and subdirectories. Check that your file extension is included with -e, that the folder is not ignored, and that the file is not in the default ignore list such as node_modules.
How does nodemon compare to node --watch, tsx or ts-node-dev?
The source lists ts-node-dev, tsx and node --watch as comparable projects but does not compare them in detail. nodemon's documented strengths are its wrapper approach, configurable watch and ignore rules, and execMap support for other languages.
New agent skills, repos and AI tools — every week
The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.
Our verdict
nodemon suits developers who run a Node.js server or script locally and want automatic restarts with configurable watch rules, and it can also run scripts in other languages through execMap. It is not meant for production servers or for restarts triggered by something other than file changes, so choose a different tool for those cases.
Install options & downloads