{"record":{"id":"39ecee90fba2abee","repo":"yarnpkg/yarn","slug":"couldntfindversionthatmatchesrange","errorCode":null,"errorMessage":"couldntFindVersionThatMatchesRange","messagePattern":"couldntFindVersionThatMatchesRange","errorType":"exception","errorClass":"MessageError","httpStatus":null,"severity":"error","filePath":"src/resolvers/registries/npm-resolver.js","lineNumber":84,"sourceCode":"      config.reporter.log(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range));\n      let pageSize;\n      if (process.stdout instanceof tty.WriteStream) {\n        pageSize = process.stdout.rows - 2;\n      }\n      const response: {[key: string]: ?string} = await inquirer.prompt([\n        {\n          name: 'package',\n          type: 'list',\n          message: config.reporter.lang('chooseVersionFromList', body.name),\n          choices: (semver: Object).rsort(Object.keys(body.versions)),\n          pageSize,\n        },\n      ]);\n      if (response && response.package) {\n        return body.versions[response.package];\n      }\n    }\n    throw new MessageError(config.reporter.lang('couldntFindVersionThatMatchesRange', body.name, range));\n  }\n\n  async resolveRequest(desiredVersion: ?string): Promise<?Manifest> {\n    if (this.config.offline) {\n      const res = await this.resolveRequestOffline();\n      if (res != null) {\n        return res;\n      }\n    }\n\n    const escapedName = NpmRegistry.escapeName(this.name);\n    const desiredRange = desiredVersion || this.range;\n    const body = await this.config.registries.npm.request(escapedName);\n\n    if (body) {\n      return NpmResolver.findVersionInRegistryResponse(this.config, escapedName, desiredRange, body, this.request);\n    } else {\n      return null;","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/yarnpkg/yarn/blob/c2dda503f3759b5be5f0e24ecd9cf5c97a540147/src/resolvers/registries/npm-resolver.js#L66-L102","documentation":"After semver.maxSatisfying finds no match and an optional interactive version prompt yields no selection, Yarn throws — no published version in the registry satisfies the requested range.","triggerScenarios":"A dependency range (e.g., ^2.0.0) that no published version satisfies, and the interactive fallback returns nothing or is unavailable. Terminal failure of findVersionInRegistryResponse.","commonSituations":"Requesting a range before the target version is published; typo in the semver range; package only has older major versions.","solutions":["Loosen or correct the version range in package.json","Check available versions with yarn info <package> versions","Pin to a specific existing version that is published","If the version should exist, verify the registry mirror is up to date"],"exampleFix":"// before\n\"dep\": \"^3.0.0\"\n// after (no v3 published yet)\n\"dep\": \"^2.5.0\"","handlingStrategy":"validation","validationCode":"import * as semver from 'semver';\nfunction rangeHasMatch(versions: string[], range: string): boolean {\n  return semver.maxSatisfying(versions, range) !== null;\n}\nif (!rangeHasMatch(Object.keys(body.versions), range)) {\n  console.warn(`No version of ${name} satisfies ${range}`);\n}","typeGuard":"function isSatisfiableRange(versions: string[], range: string): boolean {\n  return semver.maxSatisfying(versions, range) !== null;\n}","tryCatchPattern":"try {\n  const manifest = await NpmResolver.findVersionInRegistryResponse(config, name, range, body);\n} catch (e) {\n  if (e.message.includes('couldntFindVersionThatMatchesRange')) {\n    // broaden the range or pin to an existing version\n  }\n}","preventionTips":["Run yarn info <package> versions to confirm a version exists before pinning","Avoid overly narrow or speculative ranges","Keep registry mirrors up to date"],"tags":["semver","version-range","resolution"],"backgroundTag":null,"analyzedSha":"c2dda503f3759b5be5f0e24ecd9cf5c97a540147","analyzedAt":"2026-08-13T04:17:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}