Skip to content
Agents tracked: 506 Releases (7d): 634 Agent status: 3 with issuesSince last limit reset: Claude 15d · Codex 0d For AI agents: Markdown Updated Nov 26, 2026

execa

Run other programs from Node.js code.

UtilitiesNPM

GitHubWebsite

1. License

“to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software”

Free for paid and closed products; keep the MIT notice with the package files.

github.com/sindresorhus/execa/blob/main/license

From the package registry and GitHub, checked daily; card checked Nov 11, 2026. Tap a verdict to see its source.How we checkedReport an error

What execa does

execa is a free JavaScript package that lets a Node.js script or server start other programs, such as git, ffmpeg or a build command, and read what they print. Each piece of text, like a file name a user typed, reaches the program as one separate value, so it cannot sneak in a second command. It runs only on a server or your own computer, not in a web page.

What people build with it

Build and deploy scripts

A release script in JavaScript runs the build, reads the current git branch and starts the deploy, one step after another.

Process a file a user uploaded

Your server calls an image or video tool on a file whose name came from a user; the name stays one value even if it holds spaces or a semicolon.

Stop a command that hangs

A tool your AI agent or job queue starts sometimes never ends; give it a time limit and report a clear timeout.

Show clear errors when a step fails

When a command fails, your log shows the command, its exit code and what it printed, instead of a bare crash.

Watch warnings while a build runs

Read a long command's output line by line and react to each warning as it appears, not only at the end.

Run project tools without npx

A script calls a tool installed in the project, such as a linter, without a global install.

execa popularity

71 / 100
Gid Score, #344 overall
245M
downloads a week, npm
7,666
GitHub stars
46
agent projects use it
execa: downloads per weeknpm, execa 245,361,651
execa: GitHub starssindresorhus/execa 7,666

Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated

How execa is used

  • execa is a dependency in 46 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (0.9% of the 4,867 JavaScript/TypeScript ones), #30 of 408 in utilities.
  • Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 144; those are left out of every share on this page.
  • Projects that use it most often also use tsx (78.3%), chalk (69.6%), Zod (78.3%).
  • It is more common in projects set up for Kiro (5.0%) than for GitHub Copilot (0.7%).

By coding agent

38 projects, 1.2%
21 projects, 0.7%
19 projects, 0.8%
7 projects, 5.0%
6 projects, 1.8%
6 projects, 1.3%

Often used with

In 78.3% of its projects
In 69.6% of its projects
In 78.3% of its projects
In 56.5% of its projects
In 54.3% of its projects
In 54.3% of its projects
In 43.5% of its projects
In 43.5% of its projects

More about execa

Funding
  • GitHub Sponsors: https://github.com/sindresorhus
  • Open Collective: https://opencollective.com/sindresorhus
  • Buy Me a Coffee: https://buymeacoffee.com/sindresorhus
  • Own page: https://sindresorhus.com/donate
  • Own page: https://github.com/sindresorhus/execa?sponsor=1
  • 186 GitHub sponsors

See all

More in Utilities

Alternatives

execa This page

MITGid 71245M/wk

zx

Pick zx when you want a shell-script feel with many helpers built in (fetch, prompts, globbing, spinner); it runs commands through a shell.

tinyexec

Pick tinyexec when you only need to run a command and read its output, and want a very small package.

cross-spawn

Pick cross-spawn when you only need Node's own spawn() to behave the same on Windows, with no promise layer.

Compare execa with another tool

Get started

Tell your AI assistant

“Use the npm package execa (pin execa@10.2.1, Node.js 22+) to run the external command from my server code, pass user-supplied values only as ${} or array arguments, never set shell true, add a timeout, and catch ExecaError.”

  1. Add execa to your Node.js project (version 10 needs Node.js 22 or newer).

    npm install execa

    From github.com/sindresorhus/execa/blob/main/readme.md

  2. Import it and run a command with the template syntax; spaces split the command into the program and its arguments.

    import {execa} from 'execa';
    
    const {stdout} = await execa`npm run build`;
    // Print command's output
    console.log(stdout);
    

    From github.com/sindresorhus/execa/blob/main/docs/escaping.md

Mistakes to avoid

await execaCommand('npm run build')
await execa`npm run build` (or execa`${parseCommandString(commandString)}` for a dynamic string)

execaCommand() and execaCommandSync() were removed in execa 10.

subprocess.on('spawn', onSpawn)
subprocess.nodeChildProcess.on('spawn', onSpawn)

Since execa 10 the subprocess is a plain promise; Node's ChildProcess methods moved to subprocess.nodeChildProcess.

await execa({shell: true})`convert ${userFileName} out.jpg`
Leave shell off and pass the value with ${} or in the arguments array

With the shell on, execa stops escaping arguments, so a name like 'a.png; rm -rf ~' runs a second command.

execa`echo $HOME` or execa`ls *.txt` expecting the shell to expand them
Read process.env.HOME or list files in JavaScript, then pass the values as arguments

No shell runs, so $VAR, *, | and && are passed as plain text.

npm install execa on Node.js 18 or 20
Use Node.js 22+, or pin execa@9 on older Node.js

execa 10 declares engines node >=22.

Questions

Is it safe to put a user's file name into a command?

Yes, as long as you pass it with ${} or in the arguments array and do not switch the shell on; it then reaches the program as one argument.

Does it work in the browser?

No. It is built on Node's child_process module, so it runs in Node.js on a server or your computer.

Where did execaCommand() go?

Version 10 removed execaCommand() and execaCommandSync(). Use the template syntax, or parseCommandString() for a command held in one string.

How do I know why a command failed?

The error carries the exit code and flags such as timedOut, isCanceled and isMaxBuffer.