Skip to content
Latchkey

Ionic "Cannot find module '@angular-devkit/build-angular'" in CI

An Ionic Angular app builds through @angular-devkit/build-angular, the builder referenced in angular.json. When that devDependency is missing from node_modules, ionic build (which calls ng build) throws "Cannot find module".

What this error means

ionic build or ng build fails with "An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular'".

Angular
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
See "/tmp/ng-XXXX/angular-errors.log" for further details.

Common causes

Dev dependencies were omitted in CI

@angular-devkit/build-angular is a devDependency. With --omit=dev or NODE_ENV=production it is skipped, and the builder cannot be resolved.

The package is missing or version-mismatched

It was never added, or its version does not match the installed @angular/cli, so resolution fails.

How to fix it

Install all dependencies including dev

  1. Run npm ci without omitting dev dependencies.
  2. Confirm @angular-devkit/build-angular is in package.json.
  3. Re-run ionic build.
.github/workflows/ci.yml
- run: npm ci          # do not pass --omit=dev for builds
- run: ionic build --prod

Align the builder with the Angular CLI version

Install a build-angular version matching your @angular/cli so the builder loads cleanly.

Terminal
npm install --save-dev @angular-devkit/build-angular@<matching-version>

How to prevent it

  • Never omit dev dependencies in jobs that build the app.
  • Keep Angular CLI and build-angular versions aligned.
  • Run npm ci on clean runners to surface missing packages early.

Related guides

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