A CLI tool to run multiple npm-scripts in parallel or sequential. (Maintenance fork)
npm-run-all2 is a CLI tool that orchestrates multiple npm scripts from your package.json, allowing you to run them in parallel, sequentially, or in complex combinations. It solves the problem of platform-specific script syntax—the && and & operators that work on Unix systems but fail on Windows. By providing a single, cross-platform API with commands like run-s (sequential) and run-p (parallel), it eliminates the need for developers to write shell-specific logic or install separate task runners.
This package is an actively maintained fork of the original npm-run-all, which became unmaintained. With over 1.4 million weekly downloads, npm-run-all2 continues the same API while fixing dependency issues, automating releases, and reducing technical debt. It's particularly valuable for teams working across different operating systems or managing monorepos where coordinating build steps, testing, and development servers is critical.
The tool supports glob pattern matching, so instead of writing npm run clean && npm run build:css && npm run build:js && npm run build:html, you can simply use npm-run-all clean build:*. It also provides granular control through flags like --max-parallel for limiting concurrency, --continue-on-error for fault tolerance, and --race for competitive execution where the first completed task determines the outcome.
Developers working on modern JavaScript projects—whether using React, Vue, Node.js APIs, or full-stack applications—rely on npm-run-all2 to streamline their build pipelines and development workflows. It works seamlessly with npm, Yarn, and pnpm, making it a universal solution for script orchestration in the Node.js ecosystem.
{
"scripts": {
"clean": "rimraf dist coverage",
"lint:js": "eslint src --ext .js,.ts",
"lint:css": "stylelint 'src/**/*.css'",
"test:unit": "vitest run",
"test:e2e": "playwright test",
"build:client": "vite build",
"build:server": "tsc -p tsconfig.server.json",
"dev:client": "vite --port 3000",
"dev:server": "tsx watch src/server/index.ts",
"dev": "run-p dev:*",
"lint": "run-p lint:*",
"test": "run-s test:unit test:e2e",
"build": "run-s clean lint test 'build:* -- --mode production'",
"ci": "run-s lint 'run-p --max-parallel 2 test:*' build"
},
"devDependencies": {
"npm-run-all2": "^8.0.4"
}
}Parallel development servers: Run frontend and backend dev servers simultaneously with run-p frontend backend, enabling full-stack development without opening multiple terminals. Each server gets its own process and outputs are interleaved with optional labels.
Sequential build pipelines: Execute build steps in order with run-s clean lint test build, ensuring each stage completes successfully before proceeding. If linting fails, the build never runs, saving CI/CD time and preventing broken artifacts.
Monorepo package building: Use glob patterns like run-s build:* -- --verbose to build all packages matching build:api, build:ui, build:shared in sequence, passing the --verbose flag to each underlying script without repetitive configuration.
Watch mode orchestration: Combine multiple file watchers in parallel with run-p watch:css watch:js watch:assets during development, allowing hot reload for different asset types simultaneously while keeping each watcher isolated.
CI/CD optimization: Limit parallel test suites with run-p --max-parallel 3 test:* to prevent resource exhaustion on CI runners, or use --aggregate-output to collect all test results before printing, making logs easier to parse in build systems like GitHub Actions or Jenkins.
npm install npm-run-all2pnpm add npm-run-all2bun add npm-run-all2