yarnpkg/yarn · error · Error
couldn't find ${name}
Error message
couldn't find ${name} What it means
In checkOutdated(), the unfiltered registry request for a package returns a falsy value, meaning the registry returned no packument for the name. Without that data Yarn cannot compute outdated status.
Source
Thrown at src/registries/npm-registry.js:224
const config = this.config;
const requestParts = urlParts(requestUrl);
return !!Object.keys(config).find(option => {
const parts = option.split(':');
if ((parts.length === 2 && parts[1] === '_authToken') || parts[1] === '_password') {
const registryParts = urlParts(parts[0]);
if (requestParts.host === registryParts.host && requestParts.path.startsWith(registryParts.path)) {
return true;
}
}
return false;
});
}
async checkOutdated(config: Config, name: string, range: string): CheckOutdatedReturn {
const escapedName = NpmRegistry.escapeName(name);
const req = await this.request(escapedName, {unfiltered: true});
if (!req) {
throw new Error(`couldn't find ${name}`);
}
// By default use top level 'repository' and 'homepage' values
let {repository, homepage} = req;
const wantedPkg = await NpmResolver.findVersionInRegistryResponse(config, escapedName, range, req);
// But some local repositories like Verdaccio do not return 'repository' nor 'homepage'
// in top level data structure, so we fallback to wanted package manifest
if (!repository && !homepage) {
repository = wantedPkg.repository;
homepage = wantedPkg.homepage;
}
let latest = req['dist-tags'].latest;
// In certain cases, registries do not return a 'latest' tag.
if (!latest) {
latest = wantedPkg.version;
}View on GitHub (pinned to c2dda503f3)
Solutions
- Verify the package name is spelled correctly and still published (npm view <name>)
- Ensure auth tokens are configured for private/scoped packages
- Switch to the canonical npm registry if using a lagging mirror
- Remove the package from package.json if it has been unpublished
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-check package existence before calling checkOutdated
const exists = await registry.request(escapedName, {unfiltered: true});
if (!exists) {
console.warn(`Package ${name} not found in registry; skipping outdated check`);
} Type guard
function hasRegistryEntry(response: object | null): boolean {
return response != null && typeof response === 'object';
} Try / catch
try {
await npmRegistry.checkOutdated(config, name, range);
} catch (e) {
if (e.message.includes("couldn't find")) {
// skip this package in the outdated report
}
} Prevention
- Verify package names exist before adding to dependencies
- Keep auth tokens valid for private packages
- Use the canonical registry to avoid mirror gaps
When it happens
Trigger: yarn outdated or upgrade-interactive for a package whose registry request returns null/empty. The `if (!req)` guard fires.
Common situations: Package was unpublished or renamed; private package requiring missing auth; registry mirror without the package; typo in package name.
Related errors
- Unexpected audit response (Invalid JSON): ${response}
- publishFail
- packageNotFoundRegistry
- Couldn't find package $0 required by $1 on the $2 registry.
- Unexpected audit response (Missing Metadata): ${JSON.stringi
AI-assisted analysis of yarnpkg/yarn@c2dda503f3 (2026-08-13).
Data as JSON: /api/errors/03f85e6aef9927c2.
Report an issue: GitHub.