Ionic "ionic: command not found" in CI
The ionic command comes from the @ionic/cli package. CI runners are clean, so unless you install it (globally or as a dependency and call it via npx), the shell cannot find ionic and reports command not found.
What this error means
A step running ionic build or ionic capacitor build fails with "ionic: command not found" or "/bin/sh: ionic: not found".
Shell
/bin/sh: 1: ionic: not found
##[error] Process completed with exit code 127.Common causes
@ionic/cli is not installed on the runner
The Ionic CLI is not part of a default GitHub Actions image. Without an install step the binary does not exist.
A local install was not invoked through npx
Even if @ionic/cli is a dependency, calling bare ionic may miss node_modules/.bin; it must be run via npx or an npm script.
How to fix it
Install the Ionic CLI before using it
- Install @ionic/cli globally in the job, or add it as a devDependency.
- Verify with ionic --version.
- Run your ionic build command.
.github/workflows/ci.yml
- run: npm install -g @ionic/cli
- run: ionic --version
- run: ionic buildOr run a local install via npx
Keep @ionic/cli local and invoke it with npx so the resolved binary is used.
Terminal
npm install --save-dev @ionic/cli
npx ionic buildHow to prevent it
- Install @ionic/cli explicitly in every job that needs it.
- Prefer npx or npm scripts over bare ionic calls.
- Pin the CLI version for reproducible builds.
Related guides
Ionic "Cannot find module '@angular-devkit/build-angular'" in CIFix Ionic Angular "Cannot find module '@angular-devkit/build-angular'" in CI - the Angular build builder pack…
Ionic "capacitor build" with no platform added in CIFix Ionic "ionic capacitor build" failures in CI when no native platform has been added - the android or ios…
Ionic "ng build" budget exceeded error in CIFix Ionic Angular "ng build" budget errors in CI - a production bundle grew past the configured budget and th…