Run commands concurrently
Last updated 10 days ago by gustavohenke .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install concurrently 
SYNC missed versions from official npm registry.


Travis Build Status AppVeyor Build Status master branch status

NPM Badge

Run multiple commands concurrently. Like npm run watch-js & npm run watch-less but better.

Table of contents


I like task automation with npm but the usual way to run multiple commands concurrently is npm run watch-js & npm run watch-css. That's fine but it's hard to keep on track of different outputs. Also if one process fails, others still keep running and you won't even notice the difference.

Another option would be to just run all commands in separate terminals. I got tired of opening terminals and made concurrently.


  • Cross platform (including Windows)
  • Output is easy to follow with prefixes
  • With --kill-others switch, all commands are killed if one dies
  • Spawns commands with spawn-command


The tool is written in Node.js, but you can use it to run any commands.

npm install -g concurrently

or if you are using it from npm scripts:

npm install concurrently --save


Remember to surround separate commands with quotes:

concurrently "command1 arg" "command2 arg"

Otherwise concurrently would try to run 4 separate commands: command1, arg, command2, arg.

In package.json, escape quotes:

"start": "concurrently \"command1 arg\" \"command2 arg\""

NPM run commands can be shortened:

concurrently "npm:watch-js" "npm:watch-css" "npm:watch-node"

# Equivalent to:
concurrently -n watch-js,watch-css,watch-node "npm run watch-js" "npm run watch-css" "npm run watch-node"

NPM shortened commands also support wildcards. Given the following scripts in package.json:

    "scripts": {
        // ...
        "watch-js": "...",
        "watch-css": "...",
        "watch-node": "...",
        // ...
    // ...
concurrently "npm:watch-*"

# Equivalent to:
concurrently -n js,css,node "npm run watch-js" "npm run watch-css" "npm run watch-node"

# Any name provided for the wildcard command will be used as a prefix to the wildcard
# part of the script name:
concurrently -n w: npm:watch-*

# Equivalent to:
concurrently -n w:js,w:css,w:node "npm run watch-js" "npm run watch-css" "npm run watch-node"

Good frontend one-liner example here.


concurrently [options] <command ...>

  -n, --names       List of custom names to be used in prefix template.
                    Example names: "main,browser,server"                [string]
  --name-separator  The character to split <names> on. Example usage:
                    concurrently -n "styles|scripts|server" --name-separator "|"
                                                                  [default: ","]
  -r, --raw         Output only raw output of processes, disables prettifying
                    and concurrently coloring.                         [boolean]
  -s, --success     Return exit code of zero or one based on the success or
                    failure of the "first" child to terminate, the "last child",
                    or succeed only if "all" child processes succeed.
                              [choices: "first", "last", "all"] [default: "all"]
  --no-color        Disables colors from logging                       [boolean]

Prefix styling
  -p, --prefix            Prefix used in logging for each process.
                          Possible values: index, pid, time, command, name,
                          none, or a template. Example template: "{time}-{pid}"
                         [string] [default: index or name (when --names is set)]
  -c, --prefix-colors     Comma-separated list of chalk colors to use on
                          prefixes. If there are more commands than colors, the
                          last color will be repeated.
                          - Available modifiers: reset, bold, dim, italic,
                          underline, inverse, hidden, strikethrough
                          - Available colors: black, red, green, yellow, blue,
                          magenta, cyan, white, gray
                          - Available background colors: bgBlack, bgRed,
                          bgGreen, bgYellow, bgBlue, bgMagenta, bgCyan, bgWhite
                          See for more
                          information.            [string] [default: "gray.dim"]
  -l, --prefix-length     Limit how many characters of the command is displayed
                          in prefix. The option can be used to shorten the
                          prefix when it is set to "command"
                                                          [number] [default: 10]
  -t, --timestamp-format  Specify the timestamp in moment/date-fns format.
                                   [string] [default: "yyyy-MM-dd HH:mm:ss.SSS"]

Input handling
  -i, --handle-input      Whether input should be forwarded to the child
                          processes. See examples for more information.[boolean]
  --default-input-target  Identifier for child process to which input on stdin
                          should be sent if not specified at start of input.
                          Can be either the index or the name of the process.
                                                                    [default: 0]

Killing other processes
  -k, --kill-others      kill other processes if one exits or dies     [boolean]
  --kill-others-on-fail  kill other processes if one exits with non zero status
                         code                                          [boolean]

  --restart-tries  How many times a process that died should restart.
                                                           [number] [default: 0]
  --restart-after  Delay time to respawn the process, in milliseconds.
                                                           [number] [default: 0]

  -h, --help         Show help                                         [boolean]
  -v, -V, --version  Show version number                               [boolean]


 - Output nothing more than stdout+stderr of child processes

     $ concurrently --raw "npm run watch-less" "npm run watch-js"

 - Normal output but without colors e.g. when logging to file

     $ concurrently --no-color "grunt watch" "http-server" > log

 - Custom prefix

     $ concurrently --prefix "{time}-{pid}" "npm run watch" "http-server"

 - Custom names and colored prefixes

     $ concurrently --names "HTTP,WATCH" -c "bgBlue.bold,bgMagenta.bold"
     "http-server" "npm run watch"

 - Shortened NPM run commands

     $ concurrently npm:watch-node npm:watch-js npm:watch-css

 - Send input to default

     $ concurrently --handle-input "nodemon" "npm run watch-js"
     rs  # Sends rs command to nodemon process

 - Send input to specific child identified by index

     $ concurrently --handle-input "npm run watch-js" nodemon

 - Send input to specific child identified by name

     $ concurrently --handle-input -n js,srv "npm run watch-js" nodemon

 - Shortened NPM run commands

     $ concurrently npm:watch-node npm:watch-js npm:watch-css

 - Shortened NPM run command with wildcard

     $ concurrently npm:watch-*

For more details, visit

Programmatic Usage

concurrently can be used programmatically by using the API documented below:

concurrently(commands[, options])

  • commands: an array of either strings (containing the commands to run) or objects with the shape { command, name, prefixColor }.
  • options (optional): an object containing any of the below:
    • defaultInputTarget: the default input target when reading from inputStream. Default: 0.
    • inputStream: a Readable stream to read the input from, eg process.stdin.
    • killOthers: an array of exitting conditions that will cause a process to kill others. Can contain any of success or failure.
    • outputStream: a Writable stream to write logs to. Default: process.stdout.
    • prefix: the prefix type to use when logging processes output. Possible values: index, pid, time, command, name, none, or a template (eg [{time} process: {pid}]). Default: the name of the process, or its index if no name is set.
    • prefixLength: how many characters to show when prefixing with command. Default: 10
    • raw: whether raw mode should be used, meaning strictly process output will be logged, without any prefixes, colouring or extra stuff.
    • successCondition: the condition to consider the run was successful. If first, only the first process to exit will make up the success of the run; if last, the last process that exits will determine whether the run succeeds. Anything else means all processes should exit successfully.
    • restartTries: how many attempts to restart a process that dies will be made. Default: 0.
    • restartDelay: how many milliseconds to wait between process restarts. Default: 0.
    • timestampFormat: a date-fns format to use when prefixing with time. Default: yyyy-MM-dd HH:mm:ss.ZZZ

Returns: a Promise that resolves if the run was successful (according to successCondition option), or rejects otherwise.


const concurrently = require('concurrently');
    { command: 'nodemon', name: 'server' }
], {
    prefix: 'name',
    killOthers: ['failure', 'success'],
    restartTries: 3,
}).then(success, failure);


  • Process exited with code null?

    From Node child_process documentation, exit event:

    This event is emitted after the child process ends. If the process terminated normally, code is the final exit code of the process, otherwise null. If the process terminated due to receipt of a signal, signal is the string name of the signal, otherwise null.

    So null means the process didn't terminate normally. This will make concurrent to return non-zero exit code too.

  • Does this work with the npm-replacement yarn?

    Yes! In all examples above, you may replace "npm" with "yarn".

Current Tags

  • 5.0.0                                ...           latest (10 days ago)

27 Versions

  • 5.0.0                                ...           10 days ago
  • 4.1.2                                ...           2 months ago
  • 4.1.1                                ...           4 months ago
  • 4.1.0                                ...           a year ago
  • 4.0.1                                ...           a year ago
  • 4.0.0                                ...           a year ago
  • 3.6.1                                ...           a year ago
  • 3.6.0                                ...           a year ago
  • 3.5.1                                ...           2 years ago
  • 3.5.0                                ...           2 years ago
  • 3.4.0                                ...           3 years ago
  • 3.3.0                                ...           3 years ago
  • 3.2.0                                ...           3 years ago
  • 3.1.0                                ...           3 years ago
  • 3.0.0                                ...           3 years ago
  • 3.0.0-rc1                                ...           3 years ago
  • 3.0.0-dev                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.5                                ...           5 years ago
  • 0.0.4                                ...           5 years ago
  • 0.0.3                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
Today 353
This Week 2,306
This Month 6,747
Last Day 621
Last Week 3,729
Last Month 13,270
Dependencies (9)
Dev Dependencies (4)
Dependents (569)

Copyright 2014 - 2016 © |