angular/angular-cli · error · CommandError
Unable to load package information from registry: ${e.messag
Error message
Unable to load package information from registry: ${e.message} What it means
In findCompatiblePackageVersionTask, after 'latest' metadata was fetched, any further failure while resolving a compatible version is caught, run through assertIsError, and rethrown as a CommandError 'Unable to load package information from registry: <e.message>'. It surfaces registry/network/package-not-found failures during the 'ng add' version-resolution task.
Source
Thrown at packages/angular/cli/src/commands/add/cli.ts:379
// Attempt to use the 'latest' tag from the registry.
try {
const latestManifest = await packageManager.getManifest(`${packageName}@latest`, {
registry,
});
if (latestManifest) {
const conflicts = await this.getPeerDependencyConflicts(latestManifest);
if (!conflicts) {
context.packageIdentifier = npa.resolve(latestManifest.name, latestManifest.version);
task.output = `Found compatible package version: ${color.blue(latestManifest.version)}.`;
return;
}
rejectionReasons.push(...conflicts);
}
} catch (e) {
assertIsError(e);
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
}
// 'latest' is invalid or not found, search for most recent matching package.
task.output =
'Could not find a compatible version with `latest`. Searching for a compatible version.';
let packageMetadata;
try {
packageMetadata = await packageManager.getRegistryMetadata(packageName, {
registry,
});
} catch (e) {
assertIsError(e);
throw new CommandError(`Unable to load package information from registry: ${e.message}`);
}
if (!packageMetadata) {
throw new CommandError('Unable to load package information from registry.');View on GitHub (pinned to bb72145f9a)
Solutions
- Fix the underlying cause shown in e.message — verify the package name is spelled correctly and exists on the configured registry.
- Check network/VPN/proxy settings and confirm 'npm view <package>' works with the same registry.
- For private packages, configure auth (NPM_TOKEN / .npmrc authToken) for the scope's registry.
- Retry if the error was transient (429/5xx from the registry), or pin a concrete version: 'ng add @scope/pkg@1.2.3'.
Example fix
// before ng add @anguler/localize // after (correct name) ng add @angular/localize
Defensive patterns
Strategy: try-catch
Validate before calling
const res = await fetch(`${registry.replace(/\/$/, '')}/${packageName.replace('/', '%2F')}`);
if (!res.ok) {
throw new Error(`Package '${packageName}' not reachable on ${registry} (HTTP ${res.status})`);
} Type guard
function isAggregateOrPlainError(e: unknown): e is Error {
return e instanceof Error;
} Try / catch
try {
await ngAdd(packageName, { registry });
} catch (e) {
if (String(e.message).startsWith('Unable to load package information from registry')) {
// check package name, network, and registry auth, then retry
} else { throw e; }
} Prevention
- Verify package existence with 'npm view <name>' before ng add.
- Keep connectivity to the registry (VPN/proxy/firewall) verified in CI.
- Configure auth tokens for private scopes before running ng add.
- Catch transient 429/5xx and retry with backoff.
When it happens
Trigger: During 'ng add', the version-resolution task fails while querying the registry for versions of a package whose 'latest' was invalid or not found — network failure, 404 for a nonexistent package name, private package without auth, or a custom registry being unreachable.
Common situations: Typo in the package name passed to 'ng add'; installing an @scope/private package without registry auth tokens; offline or corporate proxy blocking registry.npmjs.org; --registry pointing to a mirror that lacks the package.
Related errors
- Option --registry must be a valid URL.
- Unable to load package information from registry.
- Port ${input.port} is unavailable. Try calling this tool aga
- Search request failed with status ${response.status} (${resp
- ${parsedError.summary}
AI-assisted analysis of angular/angular-cli@bb72145f9a (2026-08-30).
Data as JSON: /api/errors/476ceac3a41edf0b.
Report an issue: GitHub.