{"record":{"id":"0444175eac861ae1","repo":"angular/angular-cli","slug":"bootstrap-call-not-found","errorCode":null,"errorMessage":"Bootstrap call not found","messagePattern":"Bootstrap call not found","errorType":"exception","errorClass":"SchematicsException","httpStatus":null,"severity":"error","filePath":"packages/schematics/angular/utility/ng-ast-utils.ts","lineNumber":51,"sourceCode":"    }\n\n    if (\n      bootstrapCallNode !== null &&\n      bootstrapCallNode.parent !== undefined &&\n      bootstrapCallNode.parent.kind === ts.SyntaxKind.CallExpression\n    ) {\n      bootstrapCall = bootstrapCallNode.parent as ts.CallExpression;\n      break;\n    }\n  }\n\n  return bootstrapCall;\n}\n\nfunction findBootstrapModulePath(host: Tree, mainPath: string): string {\n  const bootstrapCall = findBootstrapModuleCall(host, mainPath);\n  if (!bootstrapCall) {\n    throw new SchematicsException('Bootstrap call not found');\n  }\n\n  const bootstrapModule = bootstrapCall.arguments[0];\n\n  const mainText = host.readText(mainPath);\n  const source = ts.createSourceFile(mainPath, mainText, ts.ScriptTarget.Latest, true);\n  const allNodes = getSourceNodes(source);\n  const bootstrapModuleRelativePath = allNodes\n    .filter(ts.isImportDeclaration)\n    .filter((imp) => {\n      return findNode(imp, ts.SyntaxKind.Identifier, bootstrapModule.getText());\n    })\n    .map((imp) => {\n      const modulePathStringLiteral = imp.moduleSpecifier as ts.StringLiteral;\n\n      return modulePathStringLiteral.text;\n    })[0];\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/schematics/angular/utility/ng-ast-utils.ts#L33-L69","documentation":"findBootstrapModulePath parses the project's main entry (src/main.ts) looking for the `platformBrowserDynamic().bootstrapModule(...)` call. If no bootstrap module call can be found in the main file, the schematic cannot locate the root module and throws this SchematicsException.","triggerScenarios":"Running schematics (e.g. `ng add`, `ng g universal`, app-shell) on a project whose main.ts lacks a `bootstrapModule` call — because the app is standalone (bootstrapApplication), the main path in angular.json points to the wrong file, or the bootstrap code was refactored.","commonSituations":"Standalone (v14+) applications where main.ts uses `bootstrapApplication(AppComponent, ...)` while the schematic expects NgModule bootstrap; custom entry files; renamed bootstrap expression.","solutions":["If the project is standalone, the schematic/version may not support it — upgrade Angular or apply the change manually.","Verify angular.json `browser`/`main` builder option points at the real entry file containing bootstrapModule.","Restore a standard `platformBrowserDynamic().bootstrapModule(AppModule)` structure if you converted the app by hand."],"exampleFix":"// before (main.ts)\nbootstrapApplication(AppComponent, appConfig);\n// after (NgModule-style for legacy schematics)\nplatformBrowserDynamic().bootstrapModule(AppModule).catch(err => console.error(err));","handlingStrategy":"validation","validationCode":"const main = fs.readFileSync('src/main.ts', 'utf8');\nif (!main.includes('bootstrapModule') && !main.includes('bootstrapApplication')) {\n  throw new Error('main.ts contains no bootstrap call');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the standard `platformBrowserDynamic().bootstrapModule(AppModule)` (or bootstrapApplication) call in the configured main file.","Confirm the angular.json builder `main` option points to the actual entry file.","For standalone apps, verify schematic support before running ng add/generate."],"tags":["angular","schematics","bootstrap","standalone"],"backgroundTag":"bootstrap-call-not-found","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}