hcengineering/platform · error · Error
No versions found for the specified version range.
Error message
No versions found for the specified version range.
What it means
After collecting versions returned by `npm view`, the script picks the highest candidate. If the versions list is empty or no candidate survives (latestVersion stays falsy), it throws this error; note it is then re-wrapped by the outer catch as 'Unable to resolve version ... of package ...'.
Source
Thrown at foundations/core/common/scripts/install-run.js:520
const platformNpmPath = _getPlatformPath(npmPath);
const npmVersionSpawnResult = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformNpmPath, ['view', `${name}@${version}`, 'version', '--no-update-notifier', '--json'], spawnSyncOptions);
if (npmVersionSpawnResult.status !== 0) {
throw new Error(`"npm view" returned error code ${npmVersionSpawnResult.status}`);
}
const npmViewVersionOutput = npmVersionSpawnResult.stdout.toString();
const parsedVersionOutput = JSON.parse(npmViewVersionOutput);
const versions = Array.isArray(parsedVersionOutput)
? parsedVersionOutput
: [parsedVersionOutput];
let latestVersion = versions[0];
for (let i = 1; i < versions.length; i++) {
const latestVersionCandidate = versions[i];
if (_compareVersionStrings(latestVersionCandidate, latestVersion) > 0) {
latestVersion = latestVersionCandidate;
}
}
if (!latestVersion) {
throw new Error('No versions found for the specified version range.');
}
return latestVersion;
}
catch (e) {
throw new Error(`Unable to resolve version ${version} of package ${name}: ${e}`);
}
}
}
let _rushJsonFolder;
/**
* Find the absolute path to the folder containing rush.json
*/
function findRushJsonFolder() {
if (!_rushJsonFolder) {
let basePath = __dirname;
let tempPath = __dirname;
do {
const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME);View on GitHub (pinned to 63e28dc964)
Solutions
- Use a version range that matches a published version (check `npm view <name> versions`)
- If the outer error 'Unable to resolve version X of package Y' appears, read the nested cause for this message
- Pin an exact known-good version in rush.json/install-run invocation instead of a broad range
Example fix
// before node install-run-rush.js rush@>=99.0.0 // after node install-run-rush.js rush@5.100.1
Defensive patterns
Strategy: validation
Validate before calling
const versions = JSON.parse(child_process.execSync(`npm view ${name} versions --json`).toString());
if (!Array.isArray(versions) || versions.length === 0) throw new Error(`No published versions for ${name}`); Try / catch
try { resolveVersion(name, range); }
catch (e) { if (/Unable to resolve version|No versions found for the specified range/.test(e.message)) { console.error('Pick an existing version: npm view ' + name + ' versions'); } else throw e; } Prevention
- Pin exact versions that exist in the registry
- Avoid ranges above the package's latest major
- Check for unpublished versions after odd resolution failures
When it happens
Trigger: `npm view` succeeded but returned an empty/null versions list — typically when the given version range matches no published version (e.g. a version that was unpublished or a range with no satisfying release).
Common situations: Requesting a package version that was unpublished; pinning a range like >=6.0.0 for a package whose latest is 5.x; registry dist-tags empty for scoped packages.
Related errors
- Unable to resolve version ${version} of package ${name}: ${e
- No versions found for the specified version range.
- Unable to resolve version ${version} of package ${name}: ${e
- "npm view" returned error code ${npmVersionSpawnResult.statu
- "npm view" returned error code ${npmVersionSpawnResult.statu
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/e2130dc2f049433e.
Report an issue: GitHub.