angular/components · info

Angular Material has been set up in your workspace. There is

Error message

Angular Material has been set up in your workspace. There is no additional setup required for consuming Angular Material in your library project.\n\nIf you intended to run the schematic on a different project, pass the `--project` option.

What it means

The `ng-add` project setup schematic (`setupProject`) configures theming and fonts only for application projects. When the target project's `projectType` is `library`, there is nothing to set up, so it logs this warning and returns without scheduling any rules. Angular Material is already consumable from any library in the workspace once installed.

Source

Thrown at src/material/schematics/ng-add/setup-project.ts:30

import {ProjectType} from '@schematics/angular/utility/workspace-models';
import {addFontsToIndex} from './fonts/material-fonts';
import {Schema} from './schema';
import {addThemeToAppStyles} from './theming/theming';

/**
 * Scaffolds the basics of a Angular Material application, this includes:
 *  - Add Packages to package.json
 *  - Adds pre-built themes to styles.ext
 */
export default function (options: Schema): Rule {
  return async (host: Tree, context: SchematicContext) => {
    const workspace = await readWorkspace(host);
    const project = getProjectFromWorkspace(workspace, options.project);

    if (project.extensions['projectType'] === ProjectType.Application) {
      return chain([addThemeToAppStyles(options), addFontsToIndex(options)]);
    }
    context.logger.warn(
      'Angular Material has been set up in your workspace. There is no additional setup ' +
        'required for consuming Angular Material in your library project.\n\n' +
        'If you intended to run the schematic on a different project, pass the `--project` ' +
        'option.',
    );
    return;
  };
}

View on GitHub (pinned to 0411926e7d)

Solutions

  1. Re-run with an application project: `ng add @angular/material --project=my-app`.
  2. If the intent was to use Material in a library, just add `@angular/material` to the library's dependencies — no extra setup is needed.
  3. Set the workspace default project to an application if `ng add` keeps resolving the library.

Example fix

// before
ng add @angular/material --project=my-lib

// after
ng add @angular/material --project=my-app
Defensive patterns

Strategy: validation

Validate before calling

const ws = require('./angular.json');
const project = ws.projects[options.project];
if (project?.projectType !== 'application') {
  console.warn(`${options.project} is a library; ng-add setup is a no-op.`);
}

Prevention

When it happens

Trigger: Running `ng add @angular/material` (or `ng generate @angular/material:ng-add --project=<lib>`) with `--project` pointing at a library-type project in angular.json.

Common situations: Monorepos where the default project is a library, or developers explicitly passing a library project name intending to 'set up' Material inside the library.

Related errors


AI-assisted analysis of angular/components@0411926e7d (2026-08-31). Data as JSON: /api/errors/a83d159df9e78390. Report an issue: GitHub.