Error: spawn ffmpeg ENOENT means Node.js found no program named ffmpeg on PATH. Install ffmpeg, spawn the binary from ffmpeg-static, or send the same args to ReelSDK, which runs ffmpeg 8.1 for $0.02 per compute minute.

Error: spawn ffmpeg ENOENT

We reproduced it on Node.js 22 with no ffmpeg installed: spawn() threw errno -2 and, with no error listener, the process exited with code 1. ReelSDK ran the same scale in about 14 seconds without a binary.

ErrorsUpdated

node convert.mjs, Node.js 22, no ffmpeg on PATH
node:events:497
      throw er; // Unhandled 'error' event
      ^

Error: spawn ffmpeg ENOENT
    at ChildProcess._handle.onexit (node:internal/child_process:285:19)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21)
Emitted 'error' event on ChildProcess instance at:
    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
    at onErrorNT (node:internal/child_process:483:16)
    at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawn ffmpeg',
  path: 'ffmpeg',
  spawnargs: [ '-i', 'in.mp4', '-vf', 'scale=720:-2', 'out.mp4' ]
}

Node.js v22.23.2

Source: Node.js child_process docs, checked November 2026.

Where it shows up

spawn() fails before ffmpeg starts

You call spawn("ffmpeg", args) on a machine where no ffmpeg program is on the PATH. We reproduced it on Node.js 22 with spawn("ffmpeg", ["-i", "in.mp4", "-vf", "scale=720:-2", "out.mp4"]) and no ffmpeg installed.

Node prints throw er; // Unhandled 'error' event, then Error: spawn ffmpeg ENOENT and Emitted 'error' event on ChildProcess instance, then the error object with errno: -2, code: 'ENOENT', syscall: 'spawn ffmpeg', path: 'ffmpeg' and your spawnargs. The process exits with code 1.

Why it happens

ENOENT means the ffmpeg program was not found

In the Node.js error docs, ENOENT is "No such file or directory". The missing file is not your video: path: 'ffmpeg' and syscall: 'spawn ffmpeg' say it is the ffmpeg program itself.

Node looks the command up in options.env.PATH when you pass env, and in process.env.PATH otherwise. When no folder has it, the child process emits 'error'; with no listener attached, Node throws it and the process exits with code 1.

Causes and fixes

Where ffmpeg goes missing

Where ffmpeg goes missing
Where Node runsWhy ffmpeg is missingFix
Your laptop or a VMffmpeg was never installed, or its folder is not on PATHInstall it with your package manager, or spawn the ffmpeg-static path
A Docker imageThe base image ships without ffmpegInstall it in the Dockerfile, or use ffmpeg-static
Vercel, Netlify or AWS LambdaThe function runtime has no ffmpeg binaryBundle ffmpeg-static within the size limit, or call an API
systemd, PM2 or a GUI launcherNode can start with a different PATH than your shellSpawn an absolute path, or set PATH for the service
spawn with a custom envAn env without PATH makes Node search /usr/bin:/bin onlySpread process.env into the env you pass

Source: Node.js child_process docs, checked November 2026.

The local fix

Install ffmpeg, or ship it with your app

Install ffmpeg so it is on PATH, or add ffmpeg-static from npm and pass its path to spawn. It is GPL-3.0-or-later and gets nearly 4 million downloads a week; on Linux x64 it fetches an 80 MB binary of ffmpeg 7.0. With it, the same scale=720:-2 command ran with no ffmpeg on PATH and wrote a 720x1280 file.

Attach an 'error' listener either way. Your app then stays up and gets the error object with error.code set to "ENOENT". The 'close' event still fires afterwards, with code -2, so don't read that as an ffmpeg failure.

ffmpeg-static.mjs
import { spawn } from "node:child_process";
import ffmpegPath from "ffmpeg-static";

const args = ["-y", "-i", "in.mp4", "-vf", "scale=720:-2", "out.mp4"];
const ffmpeg = spawn(ffmpegPath, args);

ffmpeg.on("error", (error) => {
  console.error("ffmpeg failed to start:", error.message);
});
ffmpeg.on("close", (code) => console.log("ffmpeg exited with code", code));
absolute-path.mjs
import { spawn } from "node:child_process";

const args = ["-y", "-i", "in.mp4", "-vf", "scale=720:-2", "out.mp4"];
const ffmpeg = spawn("/usr/bin/ffmpeg", args);

ffmpeg.on("error", (error) => {
  console.error("ffmpeg failed to start:", error.message);
});
ffmpeg.on("close", (code) => console.log("ffmpeg exited with code", code));
error-listener.mjs
import { spawn } from "node:child_process";

const args = ["-y", "-i", "in.mp4", "-vf", "scale=720:-2", "out.mp4"];
const ffmpeg = spawn("ffmpeg", args);

ffmpeg.on("error", (error) => {
  if (error.code === "ENOENT") {
    console.error("ffmpeg not found on PATH:", process.env.PATH);
  } else {
    console.error("ffmpeg failed to start:", error.message);
  }
});
ffmpeg.on("close", (code) => console.log("ffmpeg exited with code", code));

Skip the binary

Or skip the binary: send the same args to the API

POST /v1/ffmpeg takes the same flags in args, your input URLs in inputs and the files to keep in outputs, and runs them on ffmpeg 8.1 on a fresh machine per job. There is no binary to install or bundle.

On a 28-second vertical video, the same scale=720:-2 command finished in about 14 seconds. Compute costs $0.02 per minute, billed per second with a 1-second minimum, so that job cost a fraction of a cent. Failed jobs are free, and new accounts get $0.50 of free credit.

convert.mjsTry it
const res = await fetch("https://api.reelsdk.com/v1/ffmpeg?wait=60", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.REELSDK_KEY}`, "Content-Type": "application/json" },
  body: JSON.stringify({
    "inputs": {
      "in.mp4": "https://api.reelsdk.com/f/out/job_x5wepdaqkop4tepq05xp/video.mp4"
    },
    "args": [
      "-i", "in.mp4", "-vf", "scale=720:-2", "-c:v", "libx264", "-crf", "23",
      "-c:a", "aac", "-movflags", "+faststart", "out.mp4"
    ],
    "outputs": ["out.mp4"]
  }),
});
const { job } = await res.json();
The same scale=720:-2 command on the API, scaled down to 720x1280.Input: 1080x1920 input

It works in your terminal but not in Node

ffmpeg runs in your shell because its folder is on your shell's PATH. Node only sees the PATH it was started with: a service manager, a process manager or a desktop launcher can start it with a shorter one, and so can a container or a serverless runtime that never had ffmpeg.

If you pass options.env to spawn, Node uses that PATH instead. Leave PATH out of it and, per the child_process docs, the lookup on Unix falls back to /usr/bin:/bin. Spread process.env into the object you pass to keep the rest.

exec() fails differently

exec("ffmpeg ...") runs the command through /bin/sh, so you get no ENOENT at all. The callback gets an error with code 127, and stderr reads /bin/sh: 1: ffmpeg: not found. The fix is the same: put ffmpeg on PATH, use an absolute path, or skip the binary.

FAQ

Questions, answered

What does ENOENT mean?

ENOENT is the system error "No such file or directory". On spawn("ffmpeg", ...), the error object's path: 'ffmpeg' tells you the missing file is the ffmpeg program, not your input video.

Why does ffmpeg work in my terminal but not in Node?

Node searches the PATH it was started with, or the PATH in the env you pass to spawn. Services, process managers, desktop launchers, containers and serverless runtimes often have a different PATH or no ffmpeg at all. Spawn an absolute path or the ffmpeg-static path to rule it out.

Is ffmpeg-static a good fix on Vercel or AWS Lambda?

It can work: it adds an 80 MB Linux x64 binary of ffmpeg 7.0 to your deployment, so check your platform's function size limit first. Sending the same args to an API avoids the binary entirely.

How do I stop the error from crashing my app?

Attach an 'error' listener to the ChildProcess that spawn() returns. Node then hands the error to your handler instead of throwing it; check error.code for "ENOENT" and show a clear message. The close event still fires afterwards with code -2.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains