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: 127Common 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
- Add the setup action for the hook language.
- Optionally set
default_language_versionso pre-commit uses it. - 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-filesPin 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.12How to prevent it
- Install each hook language runtime in CI before running pre-commit.
- Pin
default_language_versionto versions available on your runners. - Cache PRE_COMMIT_HOME so provisioned envs are reused.
Related guides
pre-commit "Executable ... not found" for a hook language env in CIFix pre-commit "Executable `X` not found" in CI - the hook language environment did not build the tool, usual…
pre-commit "RuntimeError: ... Cannot install ... environment" in CIFix pre-commit "RuntimeError: Cannot install ... environment" in CI - the framework could not build a hook la…
pre-commit additional_dependencies not found in CIFix pre-commit additional_dependencies failures in CI - a plugin listed under additional_dependencies cannot…