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.
/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
- Install and activate a version with emsdk.
- Source
emsdk_env.sh, then run emcc in the same step. - For multi-step builds, persist PATH to
$GITHUB_ENVor re-source each step.
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
emcc hello.c -o hello.htmlUse the emsdk setup action
A setup action installs, activates, and exports the environment so emcc is on PATH for the whole job.
- uses: mymindstorm/setup-emsdk@v14
with:
version: 'latest'How to prevent it
- Activate a version, not just install, before using emcc.
- Source
emsdk_env.shin each step or export PATH to$GITHUB_ENV. - Prefer a setup action that wires the environment for the whole job.