{"id":17848,"library":"npm-run-all2","title":"npm-run-all2 CLI","description":"`npm-run-all2` is a command-line interface (CLI) tool designed to efficiently manage and execute multiple npm scripts. It enables running scripts concurrently in parallel or in a specified sequence, offering fine-grained control over complex build or development workflows. As a maintenance fork of the popular `npm-run-all` package, its primary focus is on ongoing maintenance, modernizing the codebase, and ensuring compatibility with recent Node.js versions. As of its current stable version 8.0.4, it specifically requires Node.js 20 or greater. It maintains a consistent release cadence, frequently incorporating updates and addressing compatibility concerns. Its key differentiator is its commitment to supporting contemporary Node.js environments and acting as a well-maintained alternative to its predecessor, particularly for projects that require updated dependencies or strict Node.js versioning.","status":"active","version":"8.0.4","language":"javascript","source_language":"en","source_url":"https://github.com/bcomnes/npm-run-all2","tags":["javascript","cli","command","commandline","tool","npm","npm-scripts","run","sequential"],"install":[{"cmd":"npm install npm-run-all2","lang":"bash","label":"npm"},{"cmd":"yarn add npm-run-all2","lang":"bash","label":"yarn"},{"cmd":"pnpm add npm-run-all2","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Programmatic API for running scripts. CommonJS `require` is only fully supported up to v8.0.x. From v8.1.0-beta.0 (and subsequent v8.1.0 stable), the codebase is mostly ESM, favoring `import`.","wrong":"const runAll = require('npm-run-all2')","symbol":"runAll","correct":"import { runAll } from 'npm-run-all2'"},{"note":"Synchronous version of the programmatic API. CJS `require` is only fully supported up to v8.0.x; use ESM `import` for v8.1.0-beta.0 and later versions due to ESM conversion.","wrong":"const runAllSync = require('npm-run-all2').runAllSync","symbol":"runAllSync","correct":"import { runAllSync } from 'npm-run-all2'"},{"note":"While primarily a CLI, advanced use cases (e.g., testing or custom environments) might directly import the CLI entrypoint. Avoid if a higher-level API like `runAll` suffices. Direct `import` of the entrypoint is typically for side-effects or advanced scenarios.","wrong":"import { cli } from 'npm-run-all2'","symbol":"CLI Entrypoint (programmatic)","correct":"import 'npm-run-all2/bin/npm-run-all2.js'"}],"quickstart":{"code":"{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"clean\": \"rm -rf dist\",\n    \"lint\": \"eslint .\",\n    \"build:css\": \"sass src/styles.scss dist/styles.css\",\n    \"build:js\": \"rollup -c\",\n    \"build\": \"npm-run-all2 build:*\",\n    \"dev:server\": \"node server.js\",\n    \"dev:watch:css\": \"sass --watch src/styles.scss:dist/styles.css\",\n    \"dev:watch:js\": \"rollup -cw\",\n    \"start\": \"npm-run-all2 --parallel dev:server 'dev:watch:*'\",\n    \"full-setup\": \"npm-run-all2 clean lint build --sequential start\"\n  },\n  \"devDependencies\": {\n    \"npm-run-all2\": \"^8.0.0\",\n    \"eslint\": \"^8.0.0\",\n    \"sass\": \"^1.0.0\",\n    \"rollup\": \"^4.0.0\"\n  }\n}\n\n// To run the parallel development setup:\nnpm start\n\n// To run the full setup sequentially:\nnpm run full-setup","lang":"javascript","description":"Demonstrates `npm-run-all2` for parallel and sequential execution of npm scripts, including glob patterns, in a typical project setup."},"warnings":[{"fix":"Upgrade your Node.js environment to version `20.5.0` or higher.","message":"`npm-run-all2` has progressively raised its minimum Node.js version requirement. Version `8.0.0` requires Node.js `>=20.0.0`, while `7.0.0` required `^18.17.0 || >=20.5.0`. Ensure your Node.js environment meets these requirements to avoid execution failures.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Refactor programmatic imports from CommonJS `require()` to ESM `import { /* ... */ } from 'npm-run-all2'`.","message":"Starting with `v8.1.0-beta.0`, the codebase has largely converted to ES Modules. Programmatic users currently using `require('npm-run-all2')` will need to switch to ESM `import` statements when `v8.1.0` (or later versions) is officially released. This impacts how the library is consumed programmatically.","severity":"breaking","affected_versions":">=8.1.0-beta.0"},{"fix":"Upgrade to `8.0.3` or higher to ensure consistent `minimatch` glob behavior.","message":"In `v8.0.2`, the internal glob matching library was switched from `minimatch` to `picomatch`, which was then reverted back to `minimatch` in `v8.0.3` due to unforeseen issues. Users on `v8.0.2` might have experienced different or incorrect glob matching behavior for script names compared to `v8.0.1` or `v8.0.3+`.","severity":"gotcha","affected_versions":"8.0.2"},{"fix":"Explicitly install `npm-run-all2` (e.g., `npm install --save-dev npm-run-all2`) and ensure your `package.json` scripts call `npm-run-all2` instead of `npm-run-all`.","message":"This package is a maintenance fork of `npm-run-all`. While generally compatible, `npm-run-all2` aims for more modern Node.js support and active maintenance. Ensure you are explicitly using `npm-run-all2` if you intend to benefit from its updated dependencies, stricter Node.js versioning, or active bug fixes not present in the original.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Upgrade your Node.js environment to version `20.5.0` or higher (e.g., using `nvm install 20 && nvm use 20`).","cause":"The installed Node.js version is older than the minimum required by `npm-run-all2`.","error":"Error: Minimum Node.js version not met. (Current: v16.x.x, Required: >=v20.x.x)"},{"fix":"Install `npm-run-all2` locally as a `devDependency` (`npm install --save-dev npm-run-all2`) and ensure it's called via `npm run <script>` (which uses `node_modules/.bin`), or install it globally (`npm install -g npm-run-all2`) if you intend to use it directly from the terminal.","cause":"The `npm-run-all2` package is not installed or not accessible in the current execution path.","error":"`npm-run-all2: command not found` or `Error: Cannot find module 'npm-run-all2'`"},{"fix":"Refactor your code to use ESM `import` statements (e.g., `import { runAll } from 'npm-run-all2';`).","cause":"Attempting to use CommonJS `require()` for programmatic imports after `npm-run-all2` has converted to ES Modules (from v8.1.0-beta.0 onwards).","error":"TypeError: require is not a function (after upgrading past 8.0.x)"},{"fix":"Verify the script names in `package.json` and adjust the glob pattern accordingly. For `v8.0.2`, consider upgrading to `v8.0.3+` to revert to `minimatch` glob behavior.","cause":"The glob pattern used for script selection does not match any existing scripts, or the glob behavior is not what was expected.","error":"No such task: <script-name> (Did you mean <similar-script-name>?)` or unexpected script globbing results."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}