Registry / devops / npm-run-all

npm-run-all

JSON →
library4.1.5jsnpmunverified

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.

npm install npm-run-all
INSTALL
IMPORT
SIG · NPM-RUN-ALL
N
npm-run-all
devopsjavascriptv4.1.5
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

runAll
import { runAll } from 'npm-run-all';
import npmRunAll from 'npm-run-all';
The primary programmatic API is exported as named functions, not a default export. The main function is `runAll`.
runParallel
import { runParallel } from 'npm-run-all';
import { parallel } from 'npm-run-all';
For directly invoking parallel script execution from Node.js, use `runParallel`. `parallel` is a CLI option shorthand.
npm-run-all (CommonJS)
const { runAll, runSequential, runParallel } = require('npm-run-all');
const runAll = require('npm-run-all').runAll;
The `require('npm-run-all')` call returns an object containing all API functions. Destructuring is common.

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
npm-run-all --version
Debug
Known issues
breakingVersion 4.0.0 dropped support for Node.js versions 0.10 and 0.12. Ensure your Node.js environment is Node >=4.
fix
Upgrade your Node.js runtime to version 4 or higher. For modern development, Node.js 14+ is recommended.
affects: >=4.0.0
breakingIn v4.0.0, the mechanism for finding the `npm` executable changed. It now prioritizes the `NPM_EXECPATH` environment variable, which `npm run-script` sets. If `NPM_EXECPATH` is not defined, it falls back to the old method of using `npm` from the `PATH`. This might affect environments where `npm-run-all` is invoked outside of a standard `npm run` context or with specific `npm` versions.
fix
Verify that your `NPM_EXECPATH` environment variable is correctly set if you rely on a specific `npm` path. Otherwise, ensure `npm` is available in your system's `PATH`.
affects: >=4.0.0
gotchaThe `--aggregate-output` option, introduced in v4.1.0, buffers output until a task completes, preventing interleaved logs in parallel mode. However, it should NOT be used for long-running or never-finishing tasks (e.g., web servers, file watchers), as their output will never be displayed.
fix
Reserve `--aggregate-output` for short-lived tasks. For long-running processes, omit this option to allow real-time output streaming.
affects: >=4.1.0
gotchaScript names beginning with `!` could cause `npm-run-all` to behave unexpectedly due to misinterpretation.
fix
Avoid using `!` as the starting character for your npm script names. Upgrade to version 4.1.3 or higher to benefit from the fix.
affects: <4.1.3
gotchaThe `--race` option, intended to terminate all tasks once one finishes with a zero exit code (success), had a bug that caused unintentional failures when mixed with `--parallel` and `--serial` directives.
fix
Ensure you are using `npm-run-all@4.0.2` or newer to correctly use the `--race` option in combination with other execution modes.
affects: <4.0.2
Errors
Common errors & fixes
MaxListenersExceededWarning
Running a large number of tasks in parallel could trigger Node.js's default `MaxListenersExceededWarning` due to too many event listeners being attached.
fix
Upgrade to `npm-run-all@4.1.0` or newer, which includes a fix for this issue. Alternatively, consider using the `--max-parallel` option to limit the number of concurrently running tasks.
Error: The script name which starts with '!' makes `npm-run-all` confusing.
A bug in earlier versions of `npm-run-all` caused issues when npm script names started with the '!' character.
fix
Rename your npm scripts to avoid starting with '!'. Upgrade to `npm-run-all@4.1.3` or newer, which contains a fix for this specific problem.
The --aggregate-output option does not work if child tasks print large output.
In versions prior to 4.1.2, the `--aggregate-output` option could fail to function correctly if the child tasks generated a very large amount of output, or when used directly with the `npm-run-all` command itself rather than `run-s`/`run-p`.
fix
Update to `npm-run-all@4.1.2` or a later version to ensure the `--aggregate-output` option handles large outputs and works consistently across all commands.
Assertion check about --race option failed when there is a mix of --parallel and --serial.
A bug in `npm-run-all@4.0.0` and `4.0.1` caused an assertion check for the `--race` option to fail if it was used in a command that also mixed `--parallel` and `--serial` options.
fix
Upgrade to `npm-run-all@4.0.2` or a newer version to resolve the incorrect assertion failure with the `--race` option.
Upgrade
Version history
4.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources