Link Search Menu Expand Document

Principles

  • Fewer flags is better
  • Works across all platforms
  • Fewer features
  • Let individuals build on top of nodemon
  • Offer all CLI functionality as an API
  • Contributions must have and pass tests

Usage

  Usage: nodemon [options] [script.js] [args]

  Options:

  --config file ............ alternate nodemon.json config file to use
  -e, --ext ................ extensions to look for, ie. js,pug,hbs.
  -x, --exec app ........... execute script with "app", ie. -x "python -v".
  -w, --watch path.......... watch directory "path" or files. use once for
                             each directory or file to watch.
  -i, --ignore ............. ignore specific files or directories.
  -V, --verbose ............ show detail on what is causing restarts.
  -- <your args> ........... to tell nodemon stop slurping arguments.

  Note: if the script is omitted, nodemon will try to read "main" from
  package.json and without a nodemon.json, nodemon will monitor .js, .mjs, .coffee,
  .litcoffee, and .json by default.

  For advanced nodemon configuration use nodemon.json: nodemon --help config
  See also the sample: https://github.com/remy/nodemon/wiki/Sample-nodemon.json

  Examples:

  $ nodemon server.js
  $ nodemon -w ../foo server.js apparg1 apparg2
  $ nodemon --exec python app.py
  $ nodemon --exec "make build" -e "styl hbs"
  $ nodemon app.js -- --config # pass config to app.js

  All options are documented under: nodemon --help options

Options

Features

  • can run non-node scripts using --exec

Config

nodemon.jso

{
  "verbose": true,
  "ignore": ["*.test.js", "fixtures/*"],
  "execMap": {
    "rb": "ruby",
    "pde": "processing --sketch= --run"
  }
  }

package.json

{
  "name": "nodemon",
  "homepage": "http://nodemon.io",
  "...": "... other standard package.json values",
  "nodemonConfig": {
    "ignore": ["test/*", "docs/*"],
    "delay": "2500"
  }
}


Cook

watch typescript

nodemon --watch 'app/**/*.ts' --ignore 'src/**/*.spec.ts' --exec 'ts-node --log-error' app/cli/commands/Refactor.ts

watch non-node executable

nodemon --exec "python -v" ./app.py

watch non-node files

  • specifcy the extension flag with --ext

watch multiple dirs

nodemon --watch app --watch libs app/server.js

application isn’t restarting

  • enables Chokidar’s polling
  • needed in some networked environments (such as a container running nodemon reading across a mounted drive)
nodemon -L

delayed restart

nodemon --delay 10 server.js

Issues

[nodemon] Internal watch failed: watch ENOSPC

url: https://stackoverflow.com/questions/34662574/node-js-getting-error-nodemon-internal-watch-failed-watch-enospc

  • need to increase number of watchers

Copyright © 2020 Thence LLC