yarnpkg/yarn · error · MessageError

packageNotFoundRegistry

Error message

packageNotFoundRegistry

What it means

When resolveRequest returns null (no manifest found online or offline after all attempts), Yarn cannot find the package in the registry and throws packageNotFoundRegistry. This is the terminal failure after every resolution path is exhausted.

Source

Thrown at src/resolvers/registries/npm-resolver.js:188

            _remote.integrity = ssri.fromHex(_remote.hash, 'sha1').toString();
          }
        }
      }
    }
    if (
      shrunk &&
      shrunk._remote &&
      (shrunk._remote.integrity || this.config.offline || !this.config.autoAddIntegrity)
    ) {
      // if the integrity field does not exist, we're not network-restricted, and the
      // migration hasn't been disabled, it needs to be created
      return shrunk;
    }

    const desiredVersion = shrunk && shrunk.version ? shrunk.version : null;
    const info: ?Manifest = await this.resolveRequest(desiredVersion);
    if (info == null) {
      throw new MessageError(this.reporter.lang('packageNotFoundRegistry', this.name, NPM_REGISTRY_ID));
    }

    const {deprecated, dist} = info;
    if (shrunk && shrunk._remote) {
      shrunk._remote.integrity =
        dist && dist.integrity
          ? ssri.parse(dist.integrity)
          : ssri.fromHex(dist && dist.shasum ? dist.shasum : '', 'sha1');
      return shrunk;
    }

    if (typeof deprecated === 'string') {
      let human = `${info.name}@${info.version}`;
      const parentNames = this.request.parentNames;
      if (parentNames.length) {
        human = parentNames.concat(human).join(' > ');
      }
      this.reporter.warn(`${human}: ${deprecated}`);

View on GitHub (pinned to c2dda503f3)

Solutions

  1. Verify the package name is spelled correctly and published (npm view <name>)
  2. Ensure auth tokens are configured for private/scoped packages (npm config set //registry/.../:_authToken)
  3. Check the registry URL in .npmrc/.yarnrc is correct for the scope
  4. If unpublished, switch to an alternative or forked package
Defensive patterns

Strategy: validation

Validate before calling

// Confirm the package exists and is reachable before resolving
const exists = await registry.request(escapedName, {});
if (!exists) {
  throw new Error(`Package ${name} not found; check name, scope, and auth`);
}

Type guard

function isResolvablePackage(info: object | null): boolean {
  return info != null && typeof info === 'object';
}

Try / catch

try {
  const manifest = await resolver.resolveRequest(desiredVersion);
} catch (e) {
  if (e.message.includes('packageNotFoundRegistry')) {
    // correct the package name or configure auth, then retry
  }
}

Prevention

When it happens

Trigger: A package name that does not exist in the configured registry, or auth failure causes resolveRequest to return null. Throws right after `if (info == null)`.

Common situations: Typo in package name; private/scoped package without auth; unpublished package; wrong registry scope configured.

Related errors


AI-assisted analysis of yarnpkg/yarn@c2dda503f3 (2026-08-13). Data as JSON: /api/errors/c98745aad5d2009b. Report an issue: GitHub.