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 server tsconfig cannot be located. What it means
Thrown by the use-application-builder migration when converting a legacy browser/server (Universal) project to the application builder. The migration located the browser tsconfig but could not resolve the server tsconfig to a string path, so it cannot rewire build options safely and aborts the project update.
Source
Thrown at packages/schematics/angular/migrations/use-application-builder/migration.ts:116
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([
...((browserJson.get(filesPath) as string[] | undefined) ?? []),
...((serverJson.get(filesPath) as string[] | undefined) ?? []),
]);
// Server file will be added later by the means of the ssr schematic.
files.delete('server.ts');
View on GitHub (pinned to bb72145f9a)
Solutions
- Open angular.json and ensure the server build target has a valid 'tsConfig' option pointing to an existing tsconfig file (e.g. tsconfig.server.json).
- If SSR was removed, delete the server build target and related architect targets before re-running the migration.
- Recreate tsconfig.server.json (or run `ng add @angular/ssr`) so the server tsconfig exists, then re-run the migration.
- Verify the referenced tsconfig file exists on disk at the path given in angular.json.
Example fix
// before (angular.json)
"server": { "options": { "main": "server.ts" } }
// after
"server": { "options": { "main": "server.ts", "tsConfig": "tsconfig.server.json" } } Defensive patterns
Strategy: validation
Validate before calling
const serverTs = project.architect?.server?.options?.tsConfig;
if (typeof serverTs !== 'string' || !fs.existsSync(serverTs)) {
throw new Error(`Server tsconfig missing for project; fix angular.json before migrating.`);
} Type guard
function hasServerTsConfig(p: any): p is { architect: { server: { options: { tsConfig: string } } } } {
return typeof p?.architect?.server?.options?.tsConfig === 'string';
} Try / catch
try {
await runMigration('use-application-builder');
} catch (e) {
if (String(e.message).includes('server tsconfig cannot be located')) {
logger.warn('Fix the server target tsConfig in angular.json and re-run.');
} else throw e;
} Prevention
- Keep tsConfig set on every server build target in angular.json
- Never delete tsconfig.server.json without updating angular.json
- Run `ng update` migrations one major version at a time
- Validate angular.json against the builder schema before migrating
When it happens
Trigger: Running `ng update` / the use-application-builder migration on a project that has a server builder configured (e.g. @angular-devkit/build-angular:server) but whose server tsconfig path cannot be resolved from the build target options (missing/renamed 'tsConfig' option, or pointing to a nonexistent file).
Common situations: Projects upgraded across multiple Angular major versions where server tsconfig was renamed (tsconfig.server.json moved or deleted); hand-edited angular.json with server target options lacking tsConfig; Universal/SSR setups partially removed.
Related errors
- Circular builder alias references detected:
- No builder name specified.
- Package ${JSON.stringify(packageName)} has no builders defin
- Package "${packageName}" has an invalid builders manifest pa
- Cannot find builder ${JSON.stringify(builderStr)}.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/e6571a0a1713c6cb.
Report an issue: GitHub.