angular/angular-cli · error

Cannot find "${this.getArchitectTarget()}" target for the sp

Error message

Cannot find "${this.getArchitectTarget()}" target for the specified project.
You can add a package that implements these capabilities.

For example:
${choices.map(({ name, value }) => `  ${name}: ng add ${value}`).join('
')}

What it means

ArchitectBaseCommandModule.onMissingTarget warns when a builder target (e.g. build/test/serve) cannot be found for the project in angular.json and no installed package provides that builder capability. Because the target is missing, the command cannot run; the CLI lists candidate `ng add <package>` choices, and in a TTY interactively offers to install one.

Source

Thrown at packages/angular/cli/src/command-builder/architect-base-command-module.ts:248

    const { logger } = this.context;
    const choices = this.missingTargetChoices;

    if (!choices?.length) {
      logger.error(defaultMessage);

      return 1;
    }

    const missingTargetMessage =
      `Cannot find "${this.getArchitectTarget()}" target for the specified project.\n` +
      `You can add a package that implements these capabilities.\n\n` +
      `For example:\n` +
      choices.map(({ name, value }) => `  ${name}: ng add ${value}`).join('\n') +
      '\n';

    if (isTTY()) {
      // Use prompts to ask the user if they'd like to install a package.
      logger.warn(missingTargetMessage);

      const packageToInstall = await this.getMissingTargetPackageToInstall(choices);
      if (packageToInstall) {
        // Example run: `ng add angular-eslint`.
        const AddCommandModule = (await import('../commands/add/cli')).default;
        await new AddCommandModule(this.context).run({
          interactive: true,
          force: false,
          dryRun: false,
          defaults: false,
          collection: packageToInstall,
        });
      }
    } else {
      // Non TTY display error message.
      logger.error(missingTargetMessage);
    }

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Install the package that implements the capability shown in the message, e.g. `ng add angular-eslint` for lint targets.
  2. Verify angular.json contains an architect target with the expected builder name for the project you are targeting.
  3. Run `npm install` to restore missing node_modules packages that provide builders.
  4. Check you spelled the project name correctly (`--project` flag) and the target name in angular.json.

Example fix

// before: package.json has no lint builder
ng lint
// Error: Cannot find "lint" target...
// after
ng add angular-eslint
ng lint // works
Defensive patterns

Strategy: validation

Validate before calling

const cfg = JSON.parse(fs.readFileSync('angular.json', 'utf8'));
const project = cfg.projects[projectName];
if (!project?.architect?.[targetName]) {
  console.error(`Target '${targetName}' missing for '${projectName}'. Run: ng add <package providing the builder>`);
  process.exit(1);
}

Prevention

When it happens

Trigger: Running a command like `ng build`/`ng test`/`ng lint` against a project whose angular.json has no matching architect target and no node_modules package implementing the required builder (e.g. @angular-eslint/builder for lint).

Common situations: Fresh project missing an optional target (no lint/e2e configured); a builder package was uninstalled or pruned from node_modules; angular.json target removed or project misnamed on the command line; using an Angular version whose builder moved into a separate package.

Related errors


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