angular/angular-cli · error · Error

An unexpected error happened; package ${name} has no version

Error message

An unexpected error happened; package ${name} has no version ${installedVersion}.

What it means

Thrown by _buildPackageInfo when the version recorded as installed for a package could not be resolved to an actual manifest: the local package.json was absent and the registry returned no manifest for name@installedVersion. This indicates inconsistent state between what the CLI believes is installed and what exists.

Source

Thrown at packages/angular/cli/src/commands/update/update-resolver.ts:498

  if (!installedVersion) {
    installedVersion = (await getSatisfyingVersion(
      registryClient,
      npmPackageJson,
      packageJsonRange,
    )) as VersionRange | undefined;
  }

  if (!installedVersion) {
    throw new Error(
      `An unexpected error happened; could not determine version for package ${name}.`,
    );
  }

  const installedPackageJson =
    localPkgJson || (await registryClient.getManifest(name, installedVersion));
  if (!installedPackageJson) {
    throw new Error(
      `An unexpected error happened; package ${name} has no version ${installedVersion}.`,
    );
  }

  let targetVersion: VersionRange | undefined = packages.get(name);
  if (targetVersion) {
    const distTags = npmPackageJson['dist-tags'] ?? {};
    let resolvedVersion: string | undefined =
      distTags[targetVersion] ?? (targetVersion === 'next' ? distTags['latest'] : undefined);

    if (
      resolvedVersion &&
      !isReleaseAgeSatisfied(registryClient, npmPackageJson, resolvedVersion)
    ) {
      resolvedVersion = undefined;
    }

    if (resolvedVersion) {

View on GitHub (pinned to bb72145f9a)

Solutions

  1. Check network/registry access and .npmrc configuration, then retry.
  2. Reinstall the package so a local package.json exists (npm install <pkg>).
  3. Confirm the installed version still exists on the registry (npm view <pkg> versions).
  4. Update the lockfile: delete it and reinstall to resolve to an existing version.

Example fix

// before
ng update @angular/core  // local manifest missing, registry lookup failed
// after
npm install @angular/core
ng update @angular/core
Defensive patterns

Strategy: validation

Validate before calling

const { stdout } = execSync(`npm view ${name}@${version} version`, { encoding: 'utf8' });
if (!stdout.trim()) throw new Error(`${name}@${version} does not exist in the registry`);

Try / catch

try {
  await ngUpdate([name]);
} catch (e) {
  if (String(e.message).includes('has no version')) {
    // reinstall the package to resync local state with the registry, then retry
  }
}

Prevention

When it happens

Trigger: Registry client getManifest(name, installedVersion) returns null/undefined because the version does not exist in the registry (yanked/unpublished version, private registry missing the package); local package.json missing while a cached installed version string was used.

Common situations: Package unpublished or replaced after local install; offline or corporate proxy blocking registry access; private npm registry not configured (.npmrc) so the manifest lookup fails.

Related errors


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