Angular "Cannot find module '@angular-devkit/build-angular'" in CI
The builder named in angular.json (@angular-devkit/build-angular) is not in node_modules, so ng build cannot load it. It is a devDependency, so the usual cause is a pruned or incomplete install.
What this error means
ng build or ng test fails immediately with "Cannot find module '@angular-devkit/build-angular'" or "Could not find the implementation for builder".
ng
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
- /home/runner/work/app/app/node_modules/@angular/cli/...Common causes
Dev dependencies were not installed
@angular-devkit/build-angular is a devDependency; a production-only install (--omit=dev) removes it, so the builder cannot be found.
The package is missing from package.json
A partial or hand-edited package.json no longer lists the builder, so a clean install does not provide it.
How to fix it
Run a full install before building
- Use
npm ciso devDependencies are installed. - Confirm
@angular-devkit/build-angularis listed in package.json. - Re-run
ng build.
.github/workflows/ci.yml
- run: npm ci
- run: npx ng buildReinstall the builder if it is missing
Add the builder package at a version matching your Angular major.
Terminal
npm install -D @angular-devkit/build-angularHow to prevent it
- Keep a full
npm ciin the build job, not a production-only install. - Ensure the builder version matches your Angular major.
- Commit the lockfile so the builder resolves identically in CI.
Related guides
Angular "This version of CLI is only compatible with Angular versions" in CIFix Angular "This version of CLI is only compatible with Angular versions X" in CI - the installed @angular/c…
Angular "Module not found: Error: Can't resolve" in CIFix Angular "Module not found: Error: Can't resolve 'X'" in CI - the bundler cannot resolve an import path be…
Angular "Schema validation failed" for angular.json in CIFix Angular "Schema validation failed with the following errors" in CI - an option in angular.json is not all…