Skip to content
Latchkey

Angular "ng: command not found" in CI

The runner has Node and your project, but no global ng binary on PATH. CI runners do not ship the Angular CLI globally, so a script that calls bare ng fails with exit code 127.

What this error means

A step running ng build or ng test fails with "ng: command not found" and "Process completed with exit code 127", even though npm install succeeded.

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

Common causes

No globally installed Angular CLI on the runner

CI runners do not install @angular/cli globally by default, so a bare ng command has nothing to resolve on PATH.

The local CLI is not being invoked

@angular/cli is a devDependency (in node_modules/.bin) but the script calls global ng instead of the local binary.

How to fix it

Call the local CLI through npx or an npm script

Use npx so the project-local @angular/cli in node_modules is used, matching the version the project expects.

.github/workflows/ci.yml
- run: npm ci
- run: npx ng build --configuration production

Define npm scripts that use the local ng

npm run scripts put node_modules/.bin on PATH, so ng resolves to the local CLI without a global install.

package.json
"scripts": {
  "build": "ng build --configuration production",
  "test": "ng test"
}

How to prevent it

  • Keep @angular/cli as a devDependency and call it via npx or npm scripts.
  • Avoid global installs in CI so the CLI version is pinned by the lockfile.
  • Run npm ci before any ng command so node_modules/.bin exists.

Related guides

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