{"record":{"id":"35f7189537c0d857","repo":"angular/angular-cli","slug":"the-dev-server-builder-requires-a-target-to-be-s","errorCode":null,"errorMessage":"The \"dev-server\" builder requires a target to be specified.","messagePattern":"The \"dev-server\" builder requires a target to be specified\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/dev-server/builder.ts","lineNumber":60,"sourceCode":"  extensions?: {\n    buildPlugins?: Plugin[];\n    middleware?: ((\n      req: http.IncomingMessage,\n      res: http.ServerResponse,\n      next: (err?: unknown) => void,\n    ) => void)[];\n    builderSelector?: (info: BuilderSelectorInfo, logger: BuilderContext['logger']) => string;\n  },\n): Observable<DevServerBuilderOutput> {\n  // Determine project name from builder context target\n  const projectName = context.target?.project;\n  if (!projectName) {\n    context.logger.error(`The \"dev-server\" builder requires a target to be specified.`);\n\n    return EMPTY;\n  }\n\n  context.logger.warn(\n    'The \"@angular-devkit/build-angular:dev-server\" builder is deprecated as part of Angular\\'s Webpack support deprecation. ' +\n      'Use \"@angular/build:dev-server\" instead. For more information, see https://angular.dev/tools/cli/build-system-migration.',\n  );\n\n  return defer(() => initialize(options, projectName, context, extensions?.builderSelector)).pipe(\n    switchMap(({ builderName, normalizedOptions }) => {\n      // Use vite-based development server for esbuild-based builds\n      if (isEsbuildBased(builderName)) {\n        if (transforms?.logging || transforms?.webpackConfiguration) {\n          throw new Error(\n            `The \"application\" and \"browser-esbuild\" builders do not support Webpack transforms.`,\n          );\n        }\n\n        if (options.publicHost) {\n          context.logger.warn(\n            `The \"publicHost\" option will not be used because it is not supported by the \"${builderName}\" builder.`,\n          );","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/dev-server/builder.ts#L42-L78","documentation":"The dev-server builder needs a target (project) to know which application to serve. If context.target is missing (no project name), it logs this error and returns EMPTY, so the dev server never starts. Unlike other paths this is an explicit error log rather than a thrown exception.","triggerScenarios":"Scheduling the dev-server builder without a target (e.g. architect.scheduleTarget({ target: ... } omitted or builder context lacking context.target.project), or `ng serve` run where the target cannot be resolved.","commonSituations":"Running `ng serve` outside a properly configured workspace; custom tooling calling the builder programmatically without specifying the project; corrupted angular.json missing the default project.","solutions":["Run `ng serve <project-name>` explicitly naming the project.","Set `defaultProject`/`cli.defaultProject`-equivalent or ensure angular.json defines the project correctly.","When calling scheduleTarget programmatically, include a valid target: `{ project: 'app', target: 'serve' }`."],"exampleFix":"// before\nng serve\n// after\nng serve my-app","handlingStrategy":"validation","validationCode":"const projectName = context.target?.project;\nif (!projectName) {\n  throw new Error('dev-server requires a target: pass a project, e.g. ng serve <project>');\n}","typeGuard":"function hasTarget(c: { target?: { project?: string } }): c is { target: { project: string } } {\n  return typeof c.target?.project === 'string' && c.target.project.length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always specify the project when a workspace has multiple projects.","Keep angular.json valid; run `ng analytics`/`ng serve` from the workspace root.","In scripts, pass `--project` explicitly instead of relying on defaults."],"tags":["angular-cli","dev-server","missing-target","configuration"],"backgroundTag":"missing-build-target","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}