Node "spawn ENOENT" for a Child Process in CI - Fix the Missing Executable
spawn ENOENT means child_process could not find the executable you asked it to run. The binary is not on PATH on the CI runner.
What this error means
A node process that shells out throws Error: spawn <command> ENOENT. The command runs locally but the executable is absent from the runner.
node
Error: spawn git ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:286:19)
at onErrorNT (node:internal/child_process:484:16) {
errno: -2, code: 'ENOENT', syscall: 'spawn git'
}Common causes
The executable is not installed on the runner
The CI image lacks the binary the child process invokes, so spawn cannot locate it.
A typo or a shell builtin spawned without a shell
A misspelled command, or a shell builtin spawned without shell: true, has no matching executable on PATH.
How to fix it
Install the executable in CI
- Add a setup step that installs the required binary.
- Re-run so spawn can find it on PATH.
GitHub Actions
- run: sudo apt-get update && sudo apt-get install -y graphvizRun shell builtins through a shell
- For a shell builtin or pipeline, pass shell: true to spawn.
- Otherwise verify the command name is spelled correctly.
JavaScript
spawn('dot -V', { shell: true });How to prevent it
- Install every external binary your scripts spawn as an explicit CI setup step, verify command names, and prefer absolute paths or shell: true where appropriate.
Related guides
Node "ENOENT no such file or directory, open" in CI - Fix the Missing FileFix the Node.js "ENOENT: no such file or directory, open" error in CI by resolving paths against the right wo…
Node "process.exit called with code 1" Fails the Job in CI - Trace the CauseFix CI jobs failing on a Node.js process.exit(1) by finding the deliberate exit call and addressing the condi…
Node "Error: write EPIPE" in CI - Handle the Broken PipeFix the Node.js "Error: write EPIPE" in CI by handling the stream error when a downstream reader closes the p…