Skip to content
Latchkey

Leiningen "lein: command not found" on the runner in CI

The shell could not find a lein executable on PATH. GitHub-hosted runners do not all ship Leiningen, and a self-hosted runner may never have had it installed, so the step fails before any build work.

What this error means

A step calling lein test or lein uberjar fails with "lein: command not found" and exit code 127.

lein
/home/runner/work/_temp/script.sh: line 1: lein: command not found
Error: Process completed with exit code 127.

Common causes

Leiningen is not installed on the runner

The runner image has a JDK but no lein, and no setup step installs it.

lein is installed but not on PATH

The script was downloaded to a directory that is not on PATH, so the shell cannot find it.

How to fix it

Install Leiningen with a setup action

Use a Clojure setup action that provisions lein (and a JDK) on the runner.

.github/workflows/ci.yml
- uses: DeLaGuardo/setup-clojure@13.0
  with:
    lein: latest
- uses: actions/setup-java@v4
  with:
    distribution: temurin
    java-version: '21'

Install the lein script manually

Download the wrapper, mark it executable, and put it on PATH.

Terminal
curl -o /usr/local/bin/lein https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein
chmod +x /usr/local/bin/lein
lein version

How to prevent it

  • Provision Leiningen with a setup step, not by assuming the image has it.
  • Pin the setup action and lein version for reproducible runs.
  • Verify with lein version early so a missing install fails fast.

Related guides

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