{"record":{"id":"8cf9fb0585e7fa0e","repo":"hcengineering/platform","slug":"no-versions-found-for-the-specified-version-range-8cf9fb","errorCode":null,"errorMessage":"No versions found for the specified version range.","messagePattern":"No versions found for the specified version range\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/net/common/scripts/install-run.js","lineNumber":520,"sourceCode":"            const platformNpmPath = _getPlatformPath(npmPath);\n            const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformNpmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier', '--json'], spawnSyncOptions);\n            if (npmVersionSpawnResult.status !== 0) {\n                throw new Error(`\"npm view\" returned error code ${npmVersionSpawnResult.status}`);\n            }\n            const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString();\n            const parsedVersionOutput = JSON.parse(npmViewVersionOutput);\n            const versions = Array.isArray(parsedVersionOutput)\n                ? parsedVersionOutput\n                : [parsedVersionOutput];\n            let latestVersion = versions[0];\n            for (let i = 1; i < versions.length; i++) {\n                const latestVersionCandidate = versions[i];\n                if (_compareVersionStrings(latestVersionCandidate, latestVersion) > 0) {\n                    latestVersion = latestVersionCandidate;\n                }\n            }\n            if (!latestVersion) {\n                throw new Error('No versions found for the specified version range.');\n            }\n            return latestVersion;\n        }\n        catch (e) {\n            throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`);\n        }\n    }\n}\nlet _rushJsonFolder;\n/**\n * Find the absolute path to the folder containing rush.json\n */\nfunction findRushJsonFolder() {\n    if (!_rushJsonFolder) {\n        let basePath = __dirname;\n        let tempPath = __dirname;\n        do {\n            const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME);","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/net/common/scripts/install-run.js#L502-L538","documentation":"After `npm view <name>@<version> version --json` succeeds, _resolvePackageVersion iterates the returned versions to find the maximum. If the output yields an empty list (or JSON.parse produced nothing usable), latestVersion stays empty and this Error is thrown — the specified range matched no published versions.","triggerScenarios":"A version range/rather exotic specifier (e.g. >9.9.9, a dist-tag-like string) that resolves against the registry but returns zero versions, so the comparison loop never sets latestVersion.","commonSituations":"A range too high for the package's published versions; querying an empty/newly created private package; mirror/registry returning an empty but successful result; npm returning an unexpected JSON shape after a registry change.","solutions":["Use a broader or valid version range, e.g. rush@^5 instead of a range above every published version.","Run `npm view <name> versions --json` to see which versions actually exist and pick one.","Pin an exact published version to bypass range resolution: install-run.js <name>@<exact>.","Check registry/mirror health if the package clearly has versions but an empty result came back."],"exampleFix":"// before\nnode install-run.js typescript@>99.0.0  // no versions match\n// after\nnode install-run.js typescript@^5.0.0   // resolves to latest matching published version","handlingStrategy":"validation","validationCode":"const out = spawnSync('npm', ['view', name, 'versions', '--json'], { encoding: 'utf8' })\nconst versions = JSON.parse(out.stdout)\nif (!Array.isArray(versions) || versions.length === 0) throw new Error(`${name} has no published versions in this registry`)","typeGuard":"function hasPublishedVersions(pkg: { versions?: unknown }): pkg is { versions: string[] } {\n  return Array.isArray((pkg as any).versions) && (pkg as any).versions.length > 0\n}","tryCatchPattern":"try {\n  const v = resolvePackageVersion(name, range)\n} catch (e) {\n  if (/No versions found for the specified version range/.test(e.message)) {\n    console.error(`Range ${range} matched nothing for ${name}; run npm view ${name} versions --json and pick a valid one`)\n  }\n  throw e\n}","preventionTips":["Check `npm view <name> versions --json` before using an unusual range.","Prefer caret ranges (^x.y.z) over open-ended ranges like >x that can match nothing.","Confirm the private registry actually mirrors the package before bootstrap.","Pin exact versions in scripts where resolution failure would block a pipeline."],"tags":["npm","version-resolution","registry"],"backgroundTag":"no-matching-package-version","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}