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'".
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
- Run npm ci without omitting dev dependencies.
- Confirm @angular-devkit/build-angular is in package.json.
- Re-run ionic build.
- run: npm ci # do not pass --omit=dev for builds
- run: ionic build --prodAlign the builder with the Angular CLI version
Install a build-angular version matching your @angular/cli so the builder loads cleanly.
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.