ScriptsJul 4, 2026·3 min read

npm-run-all — Run Multiple npm Scripts in Parallel or Series

A CLI tool for running multiple npm scripts simultaneously or sequentially. Simplifies complex build pipelines with glob-pattern matching and cross-platform support.

Agent ready

Ready-to-run agent install

This asset can be installed after the agent chooses its runtime, checks the plan, and runs the matching command.

Native · 98/100Policy: allow
Agent surface
Any MCP/CLI agent
Kind
Skill
Install
Single
Trust
Trust: Established
Entrypoint
npm-run-all Overview
Direct install command
npx -y tokrepo@latest install d47f4c2f-773f-11f1-9bc6-00163e2b0d79 --target codex

Run after dry-run confirms the install plan.

Introduction

npm-run-all provides commands for orchestrating multiple npm scripts. Instead of chaining scripts with && or & (which behaves differently across shells), it offers run-s (sequential), run-p (parallel), and npm-run-all (configurable) commands that work consistently on Windows, macOS, and Linux.

What npm-run-all Does

  • Runs npm scripts sequentially with run-s, stopping on the first failure
  • Runs npm scripts in parallel with run-p, managing child process lifecycle
  • Supports glob patterns to match script names (e.g., build:* runs all build:css, build:js, etc.)
  • Provides consistent cross-platform behavior without shell-specific syntax
  • Passes arguments through to child scripts and forwards stdio streams

Architecture Overview

npm-run-all parses script name patterns from its arguments, resolves them against the scripts defined in package.json, and spawns child processes using cross-spawn for platform compatibility. In sequential mode (run-s), processes run one after another with early exit on failure. In parallel mode (run-p), all processes start simultaneously and npm-run-all monitors them, forwarding output and exit codes. When any parallel process fails, the remaining processes are terminated.

Self-Hosting & Configuration

  • Install as a dev dependency; commands (run-s, run-p, npm-run-all) are available in npm scripts
  • Use glob patterns like build:* or test:** to match multiple scripts dynamically
  • Pass the --continue-on-error flag to run-p to keep going after a parallel task fails
  • Use --race to terminate all parallel tasks when the first one finishes
  • Forward arguments to child scripts with -- --flag syntax

Key Features

  • Three commands: run-s (sequential), run-p (parallel), npm-run-all (mixed)
  • Glob-pattern script matching for dynamic build pipelines
  • Cross-platform process spawning without shell syntax issues
  • --race mode for running dev servers alongside watch tasks
  • Colored, interleaved parallel output with process labels

Comparison with Similar Tools

  • concurrently — focuses on parallel execution with richer output formatting; less support for sequential chaining
  • Shell && and & — built-in but behave differently on Windows cmd vs. Unix shells
  • Turborepo / Nx — monorepo-aware task runners with caching; heavier and designed for multi-package repos
  • wireit (Google) — npm script orchestrator with incremental builds; more configuration required

FAQ

Q: What is the difference between run-s, run-p, and npm-run-all? A: run-s runs scripts sequentially, run-p runs them in parallel, and npm-run-all supports both via --sequential and --parallel flags.

Q: How do glob patterns work? A: build:* matches any script starting with build: (one level). build:** matches nested patterns as well.

Q: Is npm-run-all still maintained? A: The original package is stable. An actively maintained fork (npm-run-all2) continues development with bug fixes and Node.js compatibility updates.

Q: Can I use it outside of npm scripts? A: Yes. Run npx run-s lint test or invoke the commands directly if installed globally.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets