angular/angular-cli · error · SchematicsException

Cannot update project "${projectName}" to use the applicatio

Error message

Cannot update project "${projectName}" to use the application builder as the browser tsconfig cannot be located.

What it means

In the `use-application-builder` migration, `updateBuildTarget` merges the browser and server build tsconfigs when converting a project to the `@angular/build:application` builder. It reads `buildTarget.options?.tsConfig` and requires a string path; when the browser target has no `tsConfig` option (or it is not a string), the migration cannot proceed safely and throws this SchematicsException, leaving the project un-migrated.

Source

Thrown at packages/schematics/angular/migrations/use-application-builder/migration.ts:109

      }
    }

    // Delete removed options
    delete options['vendorChunk'];
    delete options['commonChunk'];
    delete options['resourcesOutputPath'];
    delete options['buildOptimizer'];
    delete options['main'];
    delete options['ngswConfigPath'];
  }

  // Merge browser and server tsconfig
  if (serverTarget) {
    const browserTsConfig = buildTarget.options?.tsConfig;
    const serverTsConfig = serverTarget.options?.tsConfig;

    if (typeof browserTsConfig !== 'string') {
      throw new SchematicsException(
        `Cannot update project "${projectName}" to use the application builder` +
          ` as the browser tsconfig cannot be located.`,
      );
    }

    if (typeof serverTsConfig !== 'string') {
      throw new SchematicsException(
        `Cannot update project "${projectName}" to use the application builder` +
          ` as the server tsconfig cannot be located.`,
      );
    }

    const browserJson = new JSONFile(tree, browserTsConfig);
    const serverJson = new JSONFile(tree, serverTsConfig);

    const filesPath = ['files'];

    const files = new Set([

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Add a string `tsConfig` to the project's `build` target options in angular.json (e.g. `"tsConfig": "tsconfig.app.json"`) and re-run the migration.
  2. If tsConfig lives under `configurations`, move/duplicate the browser tsconfig path into the main `options` block before migrating.
  3. Ensure the referenced tsconfig file exists on disk, then retry `ng update @angular/cli --from <version> --to <version> --migrate-only`.

Example fix

// angular.json before
"build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/app" } }
// after
"build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/app", "tsConfig": "tsconfig.app.json" } }
Defensive patterns

Strategy: validation

Validate before calling

const build = angularJson.projects[name].architect.build;
if (typeof build?.options?.tsConfig !== 'string') {
  throw new Error(`Browser build target of "${name}" needs a string options.tsConfig before migrating to the application builder.`);
}

Type guard

function hasBrowserTsConfig(t: { options?: { tsConfig?: unknown } } | undefined): t is { options: { tsConfig: string } } {
  return typeof t?.options?.tsConfig === 'string';
}

Try / catch

try {
  await runMigration('use-application-builder');
} catch (e) {
  if (e instanceof SchematicsException && e.message.includes('browser tsconfig cannot be located')) {
    console.error('Add options.tsConfig to the browser build target in angular.json, then re-run the migration.');
  } else throw e;
}

Prevention

When it happens

Trigger: Running `ng update @angular/cli` (or the migration directly) on a project whose `build` target in angular.json lacks a string-valued `options.tsConfig` — deleted tsconfig entry, tsConfig placed only in configurations, or a hand-edited angular.json.

Common situations: Workspaces where tsconfig.spec.json/tsconfig.app.json were reorganized manually; projects generated by older CLI versions or third-party generators that omitted tsConfig from the browser target; partially reverted migrations leaving broken angular.json.

Related errors


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