angular/angular-cli · error · SchematicsException

Project "${options.project}" does not have a build target.

Error message

Project "${options.project}" does not have a build target.

What it means

The Tailwind schematic (ng add / ng generate tailwind config wiring) inserts the stylesheet into the project's `build` target options. If the project has no target named `build`, the schematic cannot find where to register styles and throws this SchematicsException.

Source

Thrown at packages/schematics/angular/tailwind/index.ts:44

  InstallBehavior,
  ProjectDefinition,
  addDependency,
  updateWorkspace,
} from '../utility';
import { JSONFile } from '../utility/json-file';
import { latestVersions } from '../utility/latest-versions';
import { createProjectSchematic } from '../utility/project';
import { Schema as TailwindOptions } from './schema';

const TAILWIND_DEPENDENCIES = ['tailwindcss', '@tailwindcss/postcss', 'postcss'];
const POSTCSS_CONFIG_FILES = ['.postcssrc.json', 'postcss.config.json'];

function addTailwindStyles(options: { project: string }, project: ProjectDefinition): Rule {
  return async (tree) => {
    const buildTarget = project.targets.get('build');

    if (!buildTarget) {
      throw new SchematicsException(`Project "${options.project}" does not have a build target.`);
    }

    const styles = buildTarget.options?.['styles'] as (string | { input: string })[] | undefined;

    let stylesheetPath: string | undefined;
    if (styles) {
      stylesheetPath = styles
        .map((s) => (typeof s === 'string' ? s : s.input))
        .find((p) => p.endsWith('.css'));
    }

    if (!stylesheetPath) {
      const newStylesheetPath = join(project.sourceRoot ?? 'src', 'tailwind.css');
      tree.create(newStylesheetPath, `@import 'tailwindcss';\n`);

      return updateWorkspace((workspace) => {
        const project = workspace.projects.get(options.project);
        if (project) {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Add a `build` target (architect section) to the project in angular.json.
  2. Rename your custom build target to `build`, or configure the styles array manually: add "styles": ["src/styles.css"] plus tailwind.config.js yourself.
  3. Run the schematic against a project that has a standard `build` target (`--project <app-name>`).

Example fix

// before (angular.json)
"architect": { "build-app": { "options": {} } }
// after
"architect": { "build": { "builder": "...", "options": { "styles": ["src/styles.css"] } } }
Defensive patterns

Strategy: validation

Validate before calling

const project = workspace.projects.get(options.project);
if (!project?.targets.get('build')) {
  throw new Error(`Project ${options.project} has no build target; the Tailwind schematic requires one.`);
}

Type guard

function hasBuildTarget(p?: { targets: Map<string, unknown> }): boolean {
  return !!p?.targets?.has('build');
}

Try / catch

try {
  await ngAdd('tailwindcss');
} catch (e) {
  if (String(e?.message).includes('does not have a build target')) {
    console.error('Add a build target to the project in angular.json or pick an application project.');
  }
  throw e;
}

Prevention

When it happens

Trigger: Running the tailwind schematic on a project whose angular.json entry defines no `build` architect target — e.g. custom target names like `build-app`, library-only projects, or hand-trimmed angular.json.

Common situations: Projects using nonstandard target names; libraries without an application build target; workspaces where the build target was renamed for multi-app setups.

Related errors


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