angular/components · warning
Your project is not using the default builders for "${target
Error message
Your project is not using the default builders for "${targetName}". This means that we cannot add the configured theme to the "${targetName}" target. What it means
The Material ng-add schematic's validateDefaultTargetBuilder checks that the workspace's build/test/serve targets use the default Angular builders (e.g. @angular-devkit/build-angular:application or browser). If the target uses a custom or third-party builder, the schematic cannot safely inject the theme path into the build configuration, so for non-build targets (like test) it only logs this warning and returns false. For the build target it throws a harder error.
Source
Thrown at src/material/schematics/ng-add/theming/theming.ts:172
targetName === 'test' ? getProjectTestTargets(project) : getProjectBuildTargets(project);
const isDefaultBuilder = targets.length > 0;
// Because the build setup for the Angular CLI can be customized by developers, we can't know
// where to put the theme file in the workspace configuration if custom builders are being
// used. In case the builder has been changed for the "build" target, we throw an error and
// exit because setting up a theme is a primary goal of `ng-add`. Otherwise if just the "test"
// builder has been changed, we warn because a theme is not mandatory for running tests
// with Material. See: https://github.com/angular/components/issues/14176
if (!isDefaultBuilder && targetName === 'build') {
throw new SchematicsException(
`Your project is not using the default builders for ` +
`"${targetName}". The Angular Material schematics cannot add a theme to the workspace ` +
`configuration if the builder has been changed.`,
);
} else if (!isDefaultBuilder) {
// for non-build targets we gracefully report the error without actually aborting the
// setup schematic. This is because a theme is not mandatory for running tests.
logger.warn(
`Your project is not using the default builders for "${targetName}". This ` +
`means that we cannot add the configured theme to the "${targetName}" target.`,
);
}
return isDefaultBuilder;
}
View on GitHub (pinned to 0411926e7d)
Solutions
- Switch the target's builder in angular.json back to the default (@angular-devkit/build-angular:application/browser or :karma) and re-run ng add.
- Manually add the generated theme file to your custom builder's styles config (styles: ["src/custom-theme.scss"]) after creating the theme yourself.
- Ignore the warning if the target is 'test' — themes are not mandatory for running tests.
Example fix
// before (angular.json) "builder": "@angular-builders/custom-webpack:browser" // after "builder": "@angular-devkit/build-angular:application" // and add src/custom-theme.scss to "options.styles"
Defensive patterns
Strategy: validation
Validate before calling
const cfg = workspace.projects[project].architect[targetName];
const DEFAULT_BUILDERS = [
'@angular-devkit/build-angular:application',
'@angular-devkit/build-angular:browser'
];
const isDefault = DEFAULT_BUILDERS.includes(cfg?.builder);
if (!isDefault) console.warn(`Manual theme wiring needed for target ${targetName}`); Prevention
- Keep default builders in angular.json, or know your custom builder's styles config location.
- After ng add, always verify the theme file appears in the target's styles array.
- In monorepos (Nx/Bazel), pre-check builder names before running Material schematics.
When it happens
Trigger: Running `ng add @angular/material` in a workspace whose angular.json configures a non-default builder for the target named targetName (e.g. a custom webpack builder, Nx builders, or @angular-builders/* packages).
Common situations: Nx/Custom Angular CLI workspaces with swapped builders; projects using esbuild-based or webpack-custom builders; monorepos where architect targets were renamed or replaced; older projects migrated to new builders leaving stale target configs.
Related errors
- Cannot create an Angular Material theme because ${
- Cannot read "${filePath}" because it does not exist.
- No data could be found for target version: ${version}
- Could not find file for path: ${path}
- Module not found: ${modulePath}
AI-assisted analysis of angular/components@0411926e7d (2026-08-31).
Data as JSON: /api/errors/899fd2e46e6edb5c.
Report an issue: GitHub.