Skip to content
Latchkey

pre-commit "node/python/ruby/go not found" for a hook language in CI

pre-commit builds each hook in an isolated environment for its declared language. If the base runtime (node, ruby, go, or a specific python) is not on the runner, the environment cannot be created.

What this error means

A hook fails while installing its environment with a "not found" for node, ruby, go, or a python version, before the hook does any linting.

pre-commit
[INFO] Installing environment for https://github.com/pre-commit/mirrors-prettier.
An unexpected error has occurred: CalledProcessError:
command: ('/bin/sh', '-c', 'node --version')
return code: 127

Common causes

The hook language runtime is absent

A node-based hook (prettier) or ruby-based hook needs that runtime present so pre-commit can build the env; the runner does not have it.

A pinned language_version is not available

Pinning language_version to a runtime version pre-commit cannot provision on the runner fails the env build.

How to fix it

Provision the runtime before pre-commit

  1. Add the setup action for the hook language.
  2. Optionally set default_language_version so pre-commit uses it.
  3. Re-run so the environment builds against the installed runtime.
.github/workflows/ci.yml
- uses: actions/setup-node@v4
  with:
    node-version: '20'
- run: pre-commit run --all-files

Pin a resolvable language version

Set default_language_version to a runtime the runner actually has.

.pre-commit-config.yaml
default_language_version:
  node: "20.11.0"
  python: python3.12

How to prevent it

  • Install each hook language runtime in CI before running pre-commit.
  • Pin default_language_version to versions available on your runners.
  • Cache PRE_COMMIT_HOME so provisioned envs are reused.

Related guides

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