angular/angular-cli · info · CommandError

Command aborted

Error message

Command aborted

What it means

After showing the interactive confirmation prompt, if the user answers 'No' (shouldProceed is falsy), confirmInstallationTask throws 'Command aborted'. This is an intentional, user-initiated cancellation of the `ng add` installation — not an internal failure.

Source

Thrown at packages/angular/cli/src/commands/add/cli.ts:592

    if (!isTTY()) {
      task.output =
        `'--skip-confirmation' can be used to bypass installation confirmation. ` +
        `Ensure package name is correct prior to '--skip-confirmation' option usage.`;
      throw new CommandError('No terminal detected');
    }

    const { ListrInquirerPromptAdapter } = await import('@listr2/prompt-adapter-inquirer');
    const { confirm } = await import('@inquirer/prompts');
    const shouldProceed = await task.prompt(ListrInquirerPromptAdapter).run(confirm, {
      message:
        `The package ${color.blue(context.packageIdentifier.toString())} will be installed and executed.\n` +
        'Would you like to proceed?',
      default: true,
      theme: { prefix: '' },
    });

    if (!shouldProceed) {
      throw new CommandError('Command aborted');
    }
  }

  private async cleanUpTemporaryDependency(packageName: string): Promise<void> {
    try {
      this.context.logger.info(`Cleaning up temporary dependency '${packageName}'...`);

      // 1. Remove from root package.json
      const projectManifest = await this.getProjectManifest();
      if (projectManifest) {
        if (projectManifest.dependencies) {
          delete projectManifest.dependencies[packageName];
        }
        if (projectManifest.devDependencies) {
          delete projectManifest.devDependencies[packageName];
        }

        await fs.writeFile(

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Re-run `ng add <package>` and answer 'Yes' (or just press Enter, since default is true) to proceed.
  2. If you never want the prompt, use `--skip-confirmation` to install without asking.
  3. Nothing is broken — verify the intended package name/version and retry.
  4. If prompts crash instead of aborting cleanly, check terminal TTY support and listr2/inquirer compatibility.

Example fix

// before
Would you like to proceed? (Y/n) n   # Command aborted
// after
Would you like to proceed? (Y/n) Y
Defensive patterns

Strategy: fallback

Validate before calling

null

Type guard

null

Try / catch

try {
  await runNgAdd(pkg);
} catch (e) {
  if (e instanceof Error && e.message === 'Command aborted') {
    console.log('Installation cancelled by user; nothing was installed.');
    return; // treat as normal cancellation, not failure
  }
  throw e;
}

Prevention

When it happens

Trigger: The user selects the default-rejecting/no answer at the 'Would you like to proceed?' confirm prompt, or aborts the prompt with Ctrl+C / Esc, causing the prompt to resolve falsy.

Common situations: Developer inspects the package to be installed and declines; accidental Enter on a misconfigured prompt theme; killing the prompt mid-way in a terminal.

Related errors


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