{"id":17457,"library":"npm-run-all","title":"npm-run-all","description":"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.","status":"active","version":"4.1.5","language":"javascript","source_language":"en","source_url":"https://github.com/mysticatea/npm-run-all","tags":["javascript","cli","command","commandline","tool","npm","npm-scripts","run","sequential"],"install":[{"cmd":"npm install npm-run-all","lang":"bash","label":"npm"},{"cmd":"yarn add npm-run-all","lang":"bash","label":"yarn"},{"cmd":"pnpm add npm-run-all","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The primary programmatic API is exported as named functions, not a default export. The main function is `runAll`.","wrong":"import npmRunAll from 'npm-run-all';","symbol":"runAll","correct":"import { runAll } from 'npm-run-all';"},{"note":"For directly invoking parallel script execution from Node.js, use `runParallel`. `parallel` is a CLI option shorthand.","wrong":"import { parallel } from 'npm-run-all';","symbol":"runParallel","correct":"import { runParallel } from 'npm-run-all';"},{"note":"The `require('npm-run-all')` call returns an object containing all API functions. Destructuring is common.","wrong":"const runAll = require('npm-run-all').runAll;","symbol":"npm-run-all (CommonJS)","correct":"const { runAll, runSequential, runParallel } = require('npm-run-all');"}],"quickstart":{"code":"{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"clean\": \"echo \\\"Cleaning build artifacts...\\\"\",\n    \"lint\": \"echo \\\"Running linter...\\\"\",\n    \"build:css\": \"echo \\\"Compiling CSS...\\\"\",\n    \"build:js\": \"echo \\\"Bundling JavaScript...\\\"\",\n    \"deploy\": \"echo \\\"Deploying application...\\\"\"\n  },\n  \"devDependencies\": {\n    \"npm-run-all\": \"^4.1.5\"\n  }\n}\n\n// To install, run: npm install npm-run-all --save-dev\n\n// 1. Run 'clean' then all 'build:*' scripts sequentially using 'run-s' shorthand.\n//    Output for each script will appear in order.\n// npx run-s clean 'build:*'\n\n// 2. Run 'lint', 'build:css', and 'build:js' in parallel using 'run-p' shorthand.\n//    Outputs might be interleaved as scripts complete.\n// npx run-p lint build:css build:js\n\n// 3. Combine sequential and parallel execution using 'npm-run-all':\n//    First 'clean', then 'lint' and 'build:css' in parallel, then 'deploy' sequentially.\n// npx npm-run-all clean --parallel lint build:css --serial deploy","lang":"javascript","description":"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."},"warnings":[{"fix":"Upgrade your Node.js runtime to version 4 or higher. For modern development, Node.js 14+ is recommended.","message":"Version 4.0.0 dropped support for Node.js versions 0.10 and 0.12. Ensure your Node.js environment is Node >=4.","severity":"breaking","affected_versions":">=4.0.0"},{"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`.","message":"In 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.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Reserve `--aggregate-output` for short-lived tasks. For long-running processes, omit this option to allow real-time output streaming.","message":"The `--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.","severity":"gotcha","affected_versions":">=4.1.0"},{"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.","message":"Script names beginning with `!` could cause `npm-run-all` to behave unexpectedly due to misinterpretation.","severity":"gotcha","affected_versions":"<4.1.3"},{"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.","message":"The `--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.","severity":"gotcha","affected_versions":"<4.0.2"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"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.","cause":"Running a large number of tasks in parallel could trigger Node.js's default `MaxListenersExceededWarning` due to too many event listeners being attached.","error":"MaxListenersExceededWarning"},{"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.","cause":"A bug in earlier versions of `npm-run-all` caused issues when npm script names started with the '!' character.","error":"Error: The script name which starts with '!' makes `npm-run-all` confusing."},{"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.","cause":"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`.","error":"The --aggregate-output option does not work if child tasks print large output."},{"fix":"Upgrade to `npm-run-all@4.0.2` or a newer version to resolve the incorrect assertion failure with the `--race` option.","cause":"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.","error":"Assertion check about --race option failed when there is a mix of --parallel and --serial."}],"ecosystem":"npm","meta_description":null}