angular/angular-cli · error · Error
Project "${project}" does not exist.
Error message
Project "${project}" does not exist. What it means
The `WorkspaceNodeModulesArchitectHost` resolves builder targets from the workspace definition. `findProjectTarget` calls `workspace.projects.get(project)` and throws when no project with that name exists in `angular.json` (or the programmatic workspace), typically because the project name was misspelled or omitted from the workspace config.
Source
Thrown at packages/angular_devkit/architect/node/node-modules-architect-host.ts:50
}
}
export interface WorkspaceHost {
getBuilderName(project: string, target: string): Promise<string>;
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);View on GitHub (pinned to bb72145f9a)
Solutions
- Correct the project name in the command or script to exactly match a project in angular.json.
- Run `ng list` / inspect angular.json's `projects` key to see valid names.
- Restore/rename the project definition in angular.json if it was accidentally removed.
- In custom code, check `workspace.projects.has(project)` before calling the architect host.
Example fix
// before ng run myap:build // after ng run myapp:build
Defensive patterns
Strategy: validation
Validate before calling
import { workspaces } from '@angular-devkit/core';
const reg = await host.getWorkspaceName?.(); // or read angular.json directly
const { projects } = JSON.parse(fs.readFileSync('angular.json', 'utf8'));
if (!projects[project]) throw new Error(`Project "${project}" not in angular.json; valid: ${Object.keys(projects).join(', ')}`); Try / catch
try {
await architectHost.findProjectTarget(workspace, project, target);
} catch (e) {
if ((e as Error).message.startsWith('Project "') && (e as Error).message.includes('does not exist')) {
console.error(`Unknown project "${project}". Check angular.json projects key.`);
process.exitCode = 1;
} else { throw e; }
} Prevention
- Never hardcode project names; read them from angular.json or CLI flags.
- Run `ng list` to confirm project names before scripting `ng run`.
- Grep CI scripts after renaming or removing projects.
When it happens
Trigger: Running a builder/architect target programmatically or via CLI (`nx`/`ng run project:target`) where `project` does not match any entry in `workspace.projects` — e.g. `ng run myap:build` instead of `myapp:build`, or a project removed/renamed in angular.json.
Common situations: Typos in the `--project` flag; custom tooling/scripts calling the architect host with hardcoded names; projects renamed after scaffolding; multi-config (extra-webpack or NX) setups where the project lives in a different workspace file.
Related errors
- Project target 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/cef7bd1fdb217aec.
Report an issue: GitHub.