Skip to content
Latchkey

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

  1. Install @ionic/cli globally in the job, or add it as a devDependency.
  2. Verify with ionic --version.
  3. Run your ionic build command.
.github/workflows/ci.yml
- run: npm install -g @ionic/cli
- run: ionic --version
- run: ionic build

Or 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 build

How 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

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