npm-run-all

4.1.5 · active · verified Wed Apr 22

npm-run-all is a command-line interface (CLI) tool designed to streamline the execution of multiple npm-scripts, allowing them to run either sequentially or in parallel. Its primary motivation is to simplify complex script sequences, moving from verbose `&&` chains to more concise, glob-pattern-friendly commands like `npm-run-all clean build:*`. Crucially, it provides cross-platform compatibility, especially for Windows environments where shell operators like `&` for parallel execution are not natively supported. The package currently stands at version 4.1.5, with a release cadence that addresses bugs and occasionally introduces new features and breaking changes, as seen with the Node.js version support changes in v4.0.0. It differentiates itself by offering dedicated shorthand commands (`run-s` for sequential, `run-p` for parallel) alongside the main `npm-run-all` command, and includes a programmatic Node API for integration into JavaScript applications.

Common errors

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to define npm scripts in `package.json` and execute them using `npm-run-all`, `run-s` (sequential), and `run-p` (parallel) via `npx` for both simple and complex task flows.

{
  "name": "my-project",
  "version": "1.0.0",
  "scripts": {
    "clean": "echo \"Cleaning build artifacts...\"",
    "lint": "echo \"Running linter...\"",
    "build:css": "echo \"Compiling CSS...\"",
    "build:js": "echo \"Bundling JavaScript...\"",
    "deploy": "echo \"Deploying application...\""
  },
  "devDependencies": {
    "npm-run-all": "^4.1.5"
  }
}

// To install, run: npm install npm-run-all --save-dev

// 1. Run 'clean' then all 'build:*' scripts sequentially using 'run-s' shorthand.
//    Output for each script will appear in order.
// npx run-s clean 'build:*'

// 2. Run 'lint', 'build:css', and 'build:js' in parallel using 'run-p' shorthand.
//    Outputs might be interleaved as scripts complete.
// npx run-p lint build:css build:js

// 3. Combine sequential and parallel execution using 'npm-run-all':
//    First 'clean', then 'lint' and 'build:css' in parallel, then 'deploy' sequentially.
// npx npm-run-all clean --parallel lint build:css --serial deploy

view raw JSON →