{"record":{"id":"61cc99c6b85b8a30","repo":"hcengineering/platform","slug":"no-versions-found-for-the-specified-version-range-61cc99","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/server/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/server/common/scripts/install-run.js#L502-L538","documentation":"After `npm view <name>@<range> version --json` succeeds, the script picks the highest returned version. If the parsed output yields an empty list (or no versions compare above the initial empty string), it throws this error meaning the range matched nothing.","triggerScenarios":"A version range (e.g. ^9.0.0) with no published matches; querying a package that exists but has no versions in the requested range; empty JSON array returned by npm view for a range with no candidates.","commonSituations":"Wrapper scripts pinned to a version range for a package whose matching versions were unpublished/deprecated; internal registry mirrors missing older versions; ranges like >=2.0.0 against a package that only published 1.x.","solutions":["Check available versions with `npm view <name> versions` and widen/correct the range","Ensure the registry mirror contains the needed versions (sync your private mirror)","Update the hardcoded package version range in the install-run-rush* wrapper script to a valid one"],"exampleFix":"// before (install-run-rushx.js constant)\nconst PACKAGE_NAME = 'rushx';\nconst PACKAGE_VERSION = '^99.0.0';\n// after\nconst PACKAGE_NAME = 'rushx';\nconst PACKAGE_VERSION = '^1.0.0';","handlingStrategy":"validation","validationCode":"const versions = JSON.parse(child_process.execSync(`npm view \"${name}@${range}\" version --json`).toString());\nconst list = Array.isArray(versions) ? versions : [versions];\nif (list.length === 0) throw new Error(`Range ${range} of ${name} matches no published versions`);","typeGuard":"function hasMatchingVersions(output) {\n  const arr = Array.isArray(output) ? output : [output];\n  return arr.length > 0 && arr.every(v => typeof v === 'string');\n}","tryCatchPattern":"try {\n  runRushInstall();\n} catch (e) {\n  if (String(e).includes('No versions found for the specified version range')) {\n    console.error(`Widen or fix the version range for ${pkg}; check npm view ${pkg} versions`);\n  } else throw e;\n}","preventionTips":["Check `npm view <pkg> versions` before pinning ranges in wrapper scripts","Avoid ranges referencing unpublished/deprecated versions","Keep private registry mirrors in sync with upstream","Pin exact versions instead of wide ranges where possible"],"tags":["npm","version-range","rush"],"backgroundTag":"no-matching-version","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}