angular/angular-cli · error · CommandError
Unable to fetch package information for '${context.packageId
Error message
Unable to fetch package information for '${context.packageIdentifier}': ${e.message} What it means
Thrown by loadPackageInfoTask when `packageManager.getManifest(packageIdentifier)` rejects. The original error is asserted to be an Error and its message is appended, so this error surfaces network failures, 404s, or auth errors from the registry while fetching the manifest for the package given to `ng add`.
Source
Thrown at packages/angular/cli/src/commands/add/cli.ts:535
return [...majorVersions.values()].sort((a, b) => compare(b, a, true));
}
private async loadPackageInfoTask(
context: AddCommandTaskContext,
task: AddCommandTaskWrapper,
options: Options<AddCommandArgs>,
): Promise<void> {
const { registry } = options;
let manifest;
try {
manifest = await this.context.packageManager.getManifest(context.packageIdentifier, {
registry,
});
} catch (e) {
assertIsError(e);
throw new CommandError(
`Unable to fetch package information for '${context.packageIdentifier}': ${e.message}`,
);
}
if (!manifest) {
throw new CommandError(
`Unable to fetch package information for '${context.packageIdentifier}'.`,
);
}
// Avoid fully resolving the package version from the registry again in later steps
if (context.packageIdentifier.registry) {
assert(context.packageIdentifier.name, 'Registry package identifier must have a name');
context.packageIdentifier = npa.resolve(
context.packageIdentifier.name,
// `save-prefix` option is ignored by some package managers so the caret is needed to ensure
// that the value in the project package.json is correct.
(context.isExactVersion ? '' : '^') + manifest.version,View on GitHub (pinned to bb72145f9a)
Solutions
- Read the appended `${e.message}` — it names the root cause (DNS, 404, 401, etc.) and fix accordingly.
- Confirm connectivity: `npm view <package>` against the same registry configured in .npmrc.
- For private packages, add the correct auth token to .npmrc (`//registry.example.com/:_authToken=...`).
- If offline, ensure the package tarball/cache is available locally or connect to the network/VPN and retry.
Example fix
// before ng add @mycompany/internal-lib # 401 from private registry # after adding token to .npmrc // after npm login --registry=https://registry.mycompany.com ng add @mycompany/internal-lib
Defensive patterns
Strategy: retry
Validate before calling
const res = await fetch(`https://registry.npmjs.org/${encodeURIComponent(pkg)}`);
if (!res.ok) throw new Error(`Registry returned ${res.status} for ${pkg}`); Type guard
function isFetchError(e: unknown): e is Error & { code?: string } {
return e instanceof Error && ('code' in e || typeof e.message === 'string');
} Try / catch
try {
await exec('ng', ['add', pkg, '--skip-confirmation']);
} catch (e) {
if (e instanceof Error && /Unable to fetch package information/.test(e.message)) {
await waitForNetwork(); // backoff then retry
await exec('ng', ['add', pkg, '--skip-confirmation']);
} else throw e;
} Prevention
- Check registry reachability at the start of CI jobs before running ng add.
- Store auth tokens for private registries in .npmrc (via secret injection, not committed).
- Retry transient network failures with exponential backoff.
- Verify proxy/VPN settings when working behind corporate networks.
When it happens
Trigger: `this.context.packageManager.getManifest(context.packageIdentifier, { registry })` throws — registry unreachable (ENOTFOUND/ECONNREFUSED), HTTP 404 for unknown package, 401/403 for private packages, TLS/proxy failures.
Common situations: Offline development; VPN/corporate proxy blocking registry access; typo in package name; private scoped package without auth token in .npmrc; self-signed certificate or custom registry outage.
Related errors
- Unable to load package information from registry.
- Unable to fetch package information for '${context.packageId
- Unable to install packages
- ${parsedError.summary}
- Package ${name} was not found on the registry. Skipping.
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/edf5a491585863bd.
Report an issue: GitHub.