A supervisor program for running nodejs programs

0.12.0  •  Published 3 years ago  •  by Petru Isfan  •  MIT License


A little supervisor script for nodejs. It runs your program, and watches for code changes, so you can have hot-code reloading-ish behavior, without worrying about memory leaks and making sure you clean up all the inter-module references, and without a whole new require system.

node-supervisor -?

Node Supervisor is used to restart programs when they crash.
It can also be used to restart programs when a *.js file changes.

  supervisor [options] <program>
  supervisor [options] -- <program> [args ...]

    The program to run.

  -w|--watch <watchItems>
    A comma-delimited list of folders or js files to watch for changes.
    When a change to a js file occurs, reload the program
    Default is '.'

  -i|--ignore <ignoreItems>
    A comma-delimited list of folders to ignore for changes.
    No default

    Ignore symlinks :)
    Log timestamp after each run.
    Make it easy to tell when the task last ran.
  -p|--poll-interval <milliseconds>
    How often to poll watched files for changes.
    Defaults to Node default.

  -e|--extensions <extensions>
    A comma-delimited list of file extensions to watch for changes.
    Default is 'node,js' (or when CoffeeScript, 'node,js,coffee,litcoffee').

  -x|--exec <executable>
    The executable that runs the specified program.
    Default is 'node'

  -pid|--save-pid <path>
    Save supervisor's process id to a file at the given path.

    Start node with --debug flag.

    Start node with --debug-brk flag.

    Start node with --harmony flag.

    Start node with --inspect flag.

  -n|--no-restart-on error|exit|success
    Don't automatically restart the supervised program if it ends.
    Supervisor will wait for a change in the source files.
    If "error", an exit code of 0 will still restart.
    If "exit", no restart regardless of exit code.
    If "success", no restart only if exit code is 0.

    Dissable interactive capacity
    With this option, supervisor won't listen to stdin

    Use instead of fs.watchFile.
    This may be useful if you see a high cpu load on a windows machine.

    Instantly kills the server process, instead of gracefully shutting down the server.
	This can be useful when the node app has events attached to SIGTERM or SIGINT so as to do a graceful shutdown before the process exits.
    Logs the file(s) that caused supervisor to restart

    Display these usage instructions.

    Suppress DEBUG messages

Options available after start:
  rs - restart process. Useful when you want to restart your program even
       if no file has changed.

  supervisor myapp.js
  supervisor -w scripts -e myext -x myrunner myapp
  supervisor -w lib,server.js,config.js server.js
  supervisor -- server.js -h host -p port

In order to not watch for file changes, use “-i .”.

Simple Install

Just run:

npm install supervisor -g

Fancy Install

Get this code, and then do this:

npm link


Weekly Downloads



Last ver 3 years ago
Created 9 years ago
Last commit 2 years ago
12 days between commits


Node version: 7.1.0
0 unpacked


MIT License
OSI Approved
0 vulnerabilities


53 contributors
Ian Young
Maintainer, 68 commits, 25 merges, 3 PRs
Maintainer, 44 commits, 22 merges, 1 PRs
Works at OPSWAT
Sam Pullara
34 commits
Maintainer, 24 commits, 1 merges, 1 PRs
Works at npm, Inc.
Oliver Wong
10 commits, 1 PRs
Works at Stripe
Corey Jewett
5 commits, 2 PRs
Works at Synthetic Playground, LLC


Ready for the next level?
Join Devstore's founding team to help us build the ultimate open-source app store, work with the latest technologies, and enjoy great culture, impact and autonomy
© 2019 Devstore, Inc.
Devstore helps developers find and use open-source packages, so they can focus on building amazing things