Skip to content
Latchkey

Emscripten "emcc: command not found" / EMSDK not activated in CI

Installing emsdk does not put emcc on PATH by itself. You must activate a version and source emsdk_env.sh in the same shell, and that environment does not persist to later CI steps unless re-sourced.

What this error means

A build step calling emcc fails with "emcc: command not found" even though an emsdk install step ran earlier in the job.

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

Common causes

emsdk activated but not sourced into this step

Each GitHub Actions step is a fresh shell. PATH set by emsdk_env.sh in one step does not carry into the next unless re-sourced or exported to the workflow env.

No active version selected

Running emsdk install latest without emsdk activate latest leaves no version on PATH, so emcc is unavailable.

How to fix it

Activate and source in the same step

  1. Install and activate a version with emsdk.
  2. Source emsdk_env.sh, then run emcc in the same step.
  3. For multi-step builds, persist PATH to $GITHUB_ENV or re-source each step.
Terminal
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
emcc hello.c -o hello.html

Use the emsdk setup action

A setup action installs, activates, and exports the environment so emcc is on PATH for the whole job.

.github/workflows/ci.yml
- uses: mymindstorm/setup-emsdk@v14
  with:
    version: 'latest'

How to prevent it

  • Activate a version, not just install, before using emcc.
  • Source emsdk_env.sh in each step or export PATH to $GITHUB_ENV.
  • Prefer a setup action that wires the environment for the whole job.

Related guides

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