Skip to content
Latchkey

Shopify "shopify: command not found" in CI

The Shopify CLI is distributed as the @shopify/cli npm package. A runner that has not installed it globally, or a project that installed it as a dev dependency, has no shopify executable on PATH, so the shell cannot find it.

What this error means

A shopify theme ... or shopify app ... step fails with "shopify: command not found" and exit code 127.

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

Common causes

The CLI is not installed on the runner

The job assumes a global shopify binary that the base image does not include.

It is a project dev dependency, not global

@shopify/cli is in package.json but a bare shopify is not on PATH; it must be run via the package runner.

How to fix it

Run the CLI through npx

Invoke the project-local CLI without a global install so the exact pinned version runs.

Terminal
npx shopify theme push --store mystore.myshopify.com

Install the CLI for the job

  1. Add @shopify/cli to the project, or install it for the step.
  2. Use npx shopify or the local bin path to invoke it.
  3. Re-run the command.
Terminal
npm install -g @shopify/cli@latest
shopify version

How to prevent it

  • Pin @shopify/cli in package.json and call it via npx.
  • Avoid relying on a global CLI the base image may not have.
  • Cache node_modules so the CLI is present each run.

Related guides

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