Angular "ng: command not found" - Fix in CI
The CI shell could not find ng. The Angular CLI is not in this job's node_modules, a production-only install skipped it, or the script assumes a global install the runner does not have.
What this error means
The step exits 127 with ng: command not found.
node
sh: 1: ng: command not found
npm ERR! code 127
npm ERR! command failedCommon causes
CLI not in dependencies
@angular/cli is not installed locally, or --omit=dev pruned it.
Script relies on global ng
The script calls bare ng instead of the local binary in node_modules/.bin.
How to fix it
Use the local CLI via npm scripts
- Install @angular/cli as a dev dependency.
- Call build through npm scripts so ng resolves from node_modules.
Terminal / package.json
npm install -D @angular/cli
# package.json
"build": "ng build"Run via npx if no script
- Invoke the locally installed CLI directly.
Terminal
npx ng build --configuration productionHow to prevent it
- Always invoke ng through npm scripts or npx, never a global install.
- Keep dev dependencies installed for build jobs.
Frequently asked questions
What causes "ng not found"?
@angular/cli is not installed locally, or --omit=dev pruned it.
How do I fix ng not found?
Use the local CLI via npm scripts
Related guides
Angular "Module build failed" - Fix in CIFix "Module build failed" during ng build in CI - a loader, a SCSS error, or a bad import breaks compilation…
Angular "Cannot find module @angular/compiler-cli" - Fix in CIFix "Cannot find module @angular/compiler-cli" in CI - the AOT compiler package is missing or version-mismatc…
Angular Budget Exceeded - Fix in CIFix "budgets exceeded" in ng build in CI - the initial or anyComponentStyle bundle grew past the configured b…