angular/angular-cli · error
The "dev-server" builder requires a target to be specified.
Error message
The "dev-server" builder requires a target to be specified.
What it means
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.
Source
Thrown at packages/angular_devkit/build_angular/src/builders/dev-server/builder.ts:60
extensions?: {
buildPlugins?: Plugin[];
middleware?: ((
req: http.IncomingMessage,
res: http.ServerResponse,
next: (err?: unknown) => void,
) => void)[];
builderSelector?: (info: BuilderSelectorInfo, logger: BuilderContext['logger']) => string;
},
): Observable<DevServerBuilderOutput> {
// Determine project name from builder context target
const projectName = context.target?.project;
if (!projectName) {
context.logger.error(`The "dev-server" builder requires a target to be specified.`);
return EMPTY;
}
context.logger.warn(
'The "@angular-devkit/build-angular:dev-server" builder is deprecated as part of Angular\'s Webpack support deprecation. ' +
'Use "@angular/build:dev-server" instead. For more information, see https://angular.dev/tools/cli/build-system-migration.',
);
return defer(() => initialize(options, projectName, context, extensions?.builderSelector)).pipe(
switchMap(({ builderName, normalizedOptions }) => {
// Use vite-based development server for esbuild-based builds
if (isEsbuildBased(builderName)) {
if (transforms?.logging || transforms?.webpackConfiguration) {
throw new Error(
`The "application" and "browser-esbuild" builders do not support Webpack transforms.`,
);
}
if (options.publicHost) {
context.logger.warn(
`The "publicHost" option will not be used because it is not supported by the "${builderName}" builder.`,
);View on GitHub (pinned to bb72145f9a)
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' }`.
Example fix
// before ng serve // after ng serve my-app
Defensive patterns
Strategy: validation
Validate before calling
const projectName = context.target?.project;
if (!projectName) {
throw new Error('dev-server requires a target: pass a project, e.g. ng serve <project>');
} Type guard
function hasTarget(c: { target?: { project?: string } }): c is { target: { project: string } } {
return typeof c.target?.project === 'string' && c.target.project.length > 0;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unsupported package manager: "${name}"
- The configured package manager, '${this.descriptor.binary}',
- Project "${project}" does not exist.
- Project target does not exist.
- A builder is not set for target '${target}' in project '${pr
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/35f7189537c0d857.
Report an issue: GitHub.