Skip to content
Latchkey

npx "could not determine executable to run" - Fix in CI

This npx error means it found (or installed) the package but could not figure out which binary to execute - usually because the package name and its bin name differ, or the package exposes no bin.

What this error means

npx <something> fails with "could not determine executable to run". npx resolved a package but there was no obvious matching command, or the package has no bin entry at all.

npx output
npm error could not determine executable to run
npm error A complete log of this run can be found in: .../_logs/...-debug-0.log

Common causes

Package name differs from its bin name

npx guesses the binary from the package name. When they differ (e.g. package @scope/tool exposing bin tool), npx cannot determine which executable to run.

The package exposes no executable

A library with no bin field has nothing for npx to run, so it errors.

Typo or uninstalled local binary

A misspelled command, or a tool expected from node_modules/.bin that was never installed, leaves npx with nothing to run.

How to fix it

Specify the package and the command explicitly

Tell npx which package to fetch and which binary to run.

Terminal
# -p selects the package, then name the actual command:
npx -p @scope/tool tool --version
# or run an installed local bin directly:
./node_modules/.bin/tool --version

Verify the bin name

  1. Check the package’s bin field for the real command name.
  2. Install the tool as a devDependency and call it via an npm script (uses node_modules/.bin).
  3. Fix any typo in the command name.

How to prevent it

  • Prefer devDependencies + npm scripts over ad hoc npx in CI.
  • Use npx -p <pkg> <bin> when name and bin differ.
  • Pin tool versions so the bin is deterministic.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →