{"record":{"id":"86110fd5519cd9cf","repo":"yarnpkg/yarn","slug":"couldn-t-find-package-0-required-by-1-on-the-2","errorCode":null,"errorMessage":"Couldn't find package $0 required by $1 on the $2 registry.","messagePattern":"Couldn't find package \\$0 required by \\$1 on the \\$2 registry\\.","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/package-request.js","lineNumber":126,"sourceCode":"      data = Object.assign({}, data);\n\n      // this is so the returned package response uses the overridden name. ie. if the\n      // package's actual name is `bar`, but it's been specified in the manifest like:\n      //   \"foo\": \"http://foo.com/bar.tar.gz\"\n      // then we use the foo name\n      data.name = name;\n      return data;\n    }\n\n    const Resolver = this.getRegistryResolver();\n    const resolver = new Resolver(this, name, range);\n    try {\n      return await resolver.resolve();\n    } catch (err) {\n      // if it is not an error thrown by yarn and it has a parent request,\n      // thow a more readable error\n      if (!(err instanceof MessageError) && this.parentRequest && this.parentRequest.pattern) {\n        throw new MessageError(\n          this.reporter.lang('requiredPackageNotFoundRegistry', pattern, this.parentRequest.pattern, this.registry),\n        );\n      }\n      throw err;\n    }\n  }\n\n  /**\n   * Get the registry resolver associated with this package request.\n   */\n\n  getRegistryResolver(): Function {\n    const Resolver = registryResolvers[this.registry];\n    if (Resolver) {\n      return Resolver;\n    } else {\n      throw new MessageError(this.reporter.lang('unknownRegistryResolver', this.registry));\n    }","sourceCodeStart":108,"sourceCodeEnd":144,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/package-request.js#L108-L144","documentation":"Thrown by `PackageRequest.getConstrainedResolvedVersion` when the registry resolver's `resolve()` throws a non-MessageError AND the current request has a `parentRequest` with a `pattern`. Instead of surfacing the raw (often cryptic, e.g. network) error, Yarn wraps it into a human-readable message naming the required package, the requirer, and the registry.","triggerScenarios":"A transitive dependency cannot be resolved from the registry: the package was unpublished, the version range matches nothing, the registry is unreachable (network error surfaces as non-MessageError), or a private registry auth failed. Because there is a parent request, Yarn reports which package required the missing one.","commonSituations":"A dependency was unpublished or yanked. A version range typo in a dependency (e.g. `^9.0.0` for a package at `8.x`). Private registry token expired or scope misconfigured (`@scope` not pointing at the right registry). Network/firewall blocking registry access.","solutions":["Verify the package and version exist on the named registry: `npm view <name>@<range>`.","Check the requirer's declared range for typos and pin a known-good version.","For scoped/private packages, confirm your `.npmrc`/`yarn config` maps the scope to the correct registry and that auth is valid.","For network errors, retry; if persistent, check connectivity, proxy (`http_proxy`), and registry status.","If the package was unpublished, update the requirer to a replacement or available version."],"exampleFix":"// before (parent requires a non-existent version)\n\"dependencies\": {\n  \"left-pad\": \"^99.0.0\"\n}\n// after\n\"dependencies\": {\n  \"left-pad\": \"^1.3.0\"\n}\n# then:\nyarn install","handlingStrategy":"retry","validationCode":"const semver = require('semver');\nasync function verifyPackageResolvable(registry, name, range) {\n  const resp = await fetch(`${registry}/${encodeURIComponent(name)}`);\n  if (!resp.ok) throw new Error(`Package '${name}' not reachable on ${registry}`);\n  const data = await resp.json();\n  const versions = Object.keys(data.versions || {});\n  if (!versions.some(v => semver.satisfies(v, range))) {\n    throw new Error(`No version of '${name}' satisfies '${range}' on ${registry}.`);\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  return await resolver.resolve();\n} catch (err) {\n  if (!(err instanceof MessageError)) {\n    // transient network/registry error — retry with backoff\n    await new Promise(r => setTimeout(r, 1000));\n    return await resolver.resolve();\n  }\n  throw err;\n}","preventionTips":["Validate dependency ranges against the registry during upgrades (`npm view <pkg>@<range>`).","Keep private registry tokens fresh; configure scope-to-registry mapping in .npmrc.","Pin versions rather than wide ranges to reduce 'no matching version' risk.","Add retry logic around resolver calls for network-resilient automation."],"tags":["registry","resolver","network","dependencies"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}