angular/angular-cli · error · SchematicsException

Project "${options.project}" does not exist.

Error message

Project "${options.project}" does not exist.

What it means

The vitest-browser schematic adds browser-testing support to a project's Vitest setup. It first resolves options.project from the workspace; if no project with that name exists it throws this SchematicsException before touching any config.

Source

Thrown at packages/schematics/angular/vitest-browser/index.ts:35

import {
  DependencyType,
  ExistingBehavior,
  InstallBehavior,
  addDependency,
} from '../utility/dependency';
import { JSONFile } from '../utility/json-file';
import { latestVersions } from '../utility/latest-versions';
import { getWorkspace } from '../utility/workspace';
import { Builders } from '../utility/workspace-models';
import { Schema as VitestBrowserOptions } from './schema';

export default function (options: VitestBrowserOptions): Rule {
  return async (host: Tree, _context: SchematicContext) => {
    const workspace = await getWorkspace(host);
    const project = workspace.projects.get(options.project);

    if (!project) {
      throw new SchematicsException(`Project "${options.project}" does not exist.`);
    }

    const testTarget = project.targets.get('test');
    if (testTarget?.builder !== Builders.BuildUnitTest) {
      throw new SchematicsException(
        `Project "${options.project}" does not have a "test" target with a supported builder.`,
      );
    }

    if (testTarget.options?.['runner'] === 'karma') {
      throw new SchematicsException(
        `Project "${options.project}" is configured to use Karma. ` +
          'Please migrate to Vitest before adding browser testing support.',
      );
    }

    const packageName = options.package;
    if (!packageName) {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Pass an existing project: `ng g vitest-browser --project=my-app` where my-app appears in angular.json.
  2. List available projects via angular.json or `ng config projects` and correct the name.
  3. Run the command from the workspace root so the correct angular.json is loaded.

Example fix

// before
ng g vitest-browser --project=frontned
// after
ng g vitest-browser --project=frontend
Defensive patterns

Strategy: validation

Validate before calling

const ws = JSON.parse(fs.readFileSync('angular.json', 'utf8'));
if (!ws.projects?.[options.project]) {
  throw new Error(`Project "${options.project}" missing; available: ${Object.keys(ws.projects ?? {}).join(', ')}`);
}

Try / catch

try {
  await ngGenerate(['vitest-browser', '--project', name]);
} catch (e) {
  if (String((e as Error).message).includes('does not exist')) {
    console.error(`Fix --project: no such project "${name}" in angular.json.`);
  } else throw e;
}

Prevention

When it happens

Trigger: Running `ng generate vitest-browser` (or the equivalent schematic invocation) with --project set to a name absent from the "projects" map in angular.json.

Common situations: Typos in the project name, running in a monorepo with multiple libs/apps and referencing an old or deleted project, or executing the schematic outside a proper Angular workspace.

Related errors


AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30). Data as JSON: /api/errors/3bd49963703b24ce. Report an issue: GitHub.