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 versionHow 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 versionearly so a missing install fails fast.
Related guides
Clojure CLI "clojure: command not found" in CIFix "clojure: command not found" (or "clj: command not found") in CI - the Clojure CLI / tools.deps is not in…
Clojure JDK version mismatch (setup-java) in CIFix Clojure builds failing on a JDK version mismatch in CI - the runner JDK is older or newer than the projec…
Leiningen "Could not find or load main class clojure.main" in CIFix "Could not find or load main class clojure.main" in CI - the JVM launched without Clojure on the classpat…