angular/angular-cli · error · Error
Project target does not exist.
Error message
Project target does not exist.
What it means
After finding the project, `findProjectTarget` looks up the target (`projectDefinition.targets.get(target)`) and throws this generic error when the named target does not exist on that project. The message intentionally does not echo names; it means the `project:target` pair's second part is wrong.
Source
Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:55
getMetadata(project: string): Promise<json.JsonObject>;
getOptions(project: string, target: string, configuration?: string): Promise<json.JsonObject>;
hasTarget(project: string, target: string): Promise<boolean>;
getDefaultConfigurationName(project: string, target: string): Promise<string | undefined>;
}
function findProjectTarget(
workspace: workspaces.WorkspaceDefinition,
project: string,
target: string,
): workspaces.TargetDefinition {
const projectDefinition = workspace.projects.get(project);
if (!projectDefinition) {
throw new Error(`Project "${project}" does not exist.`);
}
const targetDefinition = projectDefinition.targets.get(target);
if (!targetDefinition) {
throw new Error('Project target does not exist.');
}
if (!targetDefinition.builder) {
throw new Error(`A builder is not set for target '${target}' in project '${project}'.`);
}
return targetDefinition;
}
export class WorkspaceNodeModulesArchitectHost implements ArchitectHost<NodeModulesBuilderInfo> {
private workspaceHost: WorkspaceHost;
constructor(workspaceHost: WorkspaceHost, _root: string);
constructor(workspace: workspaces.WorkspaceDefinition, _root: string);
constructor(
workspaceOrHost: workspaces.WorkspaceDefinition | WorkspaceHost,View on GitHub (pinned to bb72145f9a)
Solutions
- Verify the target exists in angular.json under projects.<name>.architect (or targets).
- Fix typos in the target portion of the `project:target[:configuration]` string.
- Add the missing target definition (or run the correct builder name, e.g. `build`, `serve`, `test`).
- In custom scripts, check `projectDefinition.targets.has(target)` first for a clearer message.
Example fix
// before ng run myapp:servee // after ng run myapp:serve
Defensive patterns
Strategy: validation
Validate before calling
const cfg = JSON.parse(fs.readFileSync('angular.json', 'utf8'));
const targets = cfg.projects?.[project]?.architect ?? cfg.projects?.[project]?.targets ?? {};
if (!(target in targets)) throw new Error(`Target "${target}" missing for project "${project}"; available: ${Object.keys(targets).join(', ')}`); Try / catch
try {
await runTarget({ project, target });
} catch (e) {
if ((e as Error).message === 'Project target does not exist.') {
console.error(`Target "${target}" is not defined for "${project}".`);
} else { throw e; }
} Prevention
- Tab-complete target names with the Angular CLI instead of typing them.
- Keep the standard build/serve/test targets present in every project.
- Add a startup check that validates required project:target pairs in CI.
When it happens
Trigger: Executing `ng run project:serv` (instead of `serve`), or programmatically invoking the architect host with a target name not defined in the project's architect/targets section of angular.json.
Common situations: Typos in target names; missing `configurations`/target because the builder section was deleted; using an enterprise builder name that was never added to the project; schema differences between angular.json versions.
Related errors
- Project "${project}" does not exist.
- A builder is not set for target '${target}' in project '${pr
- Cannot determine project for command. This is a multi-projec
- The builder requires a target.
- Could not find ${level} workspace.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/b74796fed82e3282.
Report an issue: GitHub.