angular/angular-cli · warning

Setup completed successfully, but there does not seem to be

Error message

Setup completed successfully, but there does not seem to be a global install of the Angular CLI. For autocompletion to work, the CLI will need to be on your `$PATH`, which is typically done with the `-g` flag in `npm install -g @angular/cli`.

For more information, see https://angular.dev/cli/completion#global-install

What it means

The `ng completion` command warns that autocompletion was set up (sourcing lines added to the shell RC), but the running `ng` binary does not appear to be a global npm install. For completion to work at runtime the CLI must be on $PATH, which the global install normally provides.

Source

Thrown at packages/angular/cli/src/commands/completion/cli.ts:51

    try {
      rcFile = await initializeAutocomplete();
    } catch (err) {
      assertIsError(err);
      this.context.logger.error(err.message);

      return 1;
    }

    this.context.logger.info(
      `
Appended \`source <(ng completion script)\` to \`${rcFile}\`. Restart your terminal or run the following to autocomplete \`ng\` commands:

    ${colors.yellow('source <(ng completion script)')}
      `.trim(),
    );

    if ((await hasGlobalCliInstall()) === false) {
      this.context.logger.warn(
        'Setup completed successfully, but there does not seem to be a global install of the' +
          ' Angular CLI. For autocompletion to work, the CLI will need to be on your `$PATH`, which' +
          ' is typically done with the `-g` flag in `npm install -g @angular/cli`.' +
          '\n\n' +
          'For more information, see https://angular.dev/cli/completion#global-install',
      );
    }

    return 0;
  }
}

class CompletionScriptCommandModule extends CommandModule implements CommandModuleImplementation {
  command = 'script';
  describe = 'Generate a bash and zsh real-time type-ahead autocompletion script.';
  longDescriptionPath = undefined;

  builder(localYargs: Argv): Argv {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Install the CLI globally: `npm install -g @angular/cli`, then re-run `ng completion`.
  2. Ensure the global npm bin directory is on your $PATH (`npm config get prefix`).
  3. See https://angular.dev/cli/completion#global-install for setup details.

Example fix

// before
npx @angular/cli completion
// warning: no global install
// after
npm install -g @angular/cli
ng completion
Defensive patterns

Strategy: validation

Validate before calling

import { execSync } from 'node:child_process';
const prefix = execSync('npm config get prefix').toString().trim();
const onPath = process.env.PATH?.split(':').includes(`${prefix}/bin`);
if (!onPath) console.warn('Global npm bin not on $PATH; run `npm install -g @angular/cli`.');

Prevention

When it happens

Trigger: Running `ng completion` (or accepting its setup prompt) while the CLI was installed locally via `npm install @angular/cli` or via npx, so hasGlobalCliInstall() returns false.

Common situations: Projects with @angular/cli only as a devDependency; using `npx @angular/cli` without a global install; using a package manager (pnpm/yarn) whose global layout isn't detected by the check.

Related errors


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