angular/angular-cli · warning

The "@angular-devkit/build-angular:karma" builder is depreca

Error message

The "@angular-devkit/build-angular:karma" builder is deprecated as part of Angular's Webpack support deprecation. Use "@angular/build:karma" instead. For more information, see https://angular.dev/tools/cli/build-system-migration.

What it means

The @angular-devkit/build-angular:karma builder emits a deprecation warning because Angular is deprecating its Webpack-based build system. It directs users to the esbuild-based @angular/build:karma builder.

Source

Thrown at packages/angular_devkit/build_angular/src/builders/karma/index.ts:42

export type KarmaConfigOptions = ConfigOptions & {
  buildWebpack?: unknown;
  configFile?: string;
};

/**
 * @experimental Direct usage of this function is considered experimental.
 */
export async function* execute(
  options: KarmaBuilderOptions,
  context: BuilderContext,
  transforms: {
    webpackConfiguration?: ExecutionTransformer<Configuration>;
    // The karma options transform cannot be async without a refactor of the builder implementation
    karmaOptions?: (options: KarmaConfigOptions) => KarmaConfigOptions;
  } = {},
): AsyncIterable<BuilderOutput> {
  context.logger.warn(
    'The "@angular-devkit/build-angular:karma" builder is deprecated as part of Angular\'s Webpack support deprecation. ' +
      'Use "@angular/build:karma" instead. For more information, see https://angular.dev/tools/cli/build-system-migration.',
  );

  // Check Angular version.
  assertCompatibleAngularVersion(context.workspaceRoot);

  if (await checkForEsbuild(options, context)) {
    if (transforms.webpackConfiguration) {
      context.logger.warn(
        `This build is using the application builder but transforms.webpackConfiguration was provided. The transform will be ignored.`,
      );
    }

    if (options.fileReplacements) {
      options.fileReplacements = normalizeFileReplacements(options.fileReplacements, './');
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Migrate to @angular/build:karma (ng generate or manually update angular.json builder field).
  2. Run `ng update` migrations which can switch the builder automatically.
  3. Temporarily ignore the warning if migration is planned later; the builder still functions.

Example fix

// angular.json
// before
"builder": "@angular-devkit/build-angular:karma"
// after
"builder": "@angular/build:karma"
Defensive patterns

Strategy: fallback

Validate before calling

// Detect deprecated builder usage in angular.json:
const cfg = require('./angular.json');
for (const [name, p] of Object.entries(cfg.projects)) {
  for (const [t, target] of Object.entries(p.architect ?? p.targets ?? {})) {
    if (target.builder === '@angular-devkit/build-angular:karma') console.warn(`Deprecated builder on ${name}:${t} - migrate to @angular/build:karma`);
  }
}

Prevention

When it happens

Trigger: Any execution of `ng test` using the @angular-devkit/build-angular:karma builder (webpack-based) on a recent Angular version.

Common situations: Projects still using karma with the legacy webpack builder after upgrading Angular; CI logs filling with deprecation warnings.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/8a6294432641887a. Report an issue: GitHub.