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 `npm view` returns versions, _resolvePackageVersion picks the highest candidate into latestVersion. If latestVersion is still falsy — the versions list was empty (or npm returned an empty JSON result) — it throws this error. Note this throw itself is immediately caught and rewrapped by error 16's handler in normal flow.
Source
Thrown at foundations/communication/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
- Verify the version range is valid semver and that versions satisfying it exist (`npm view <name> versions`).
- Use an explicit existing version instead of a range.
- Check the package wasn't unpublished (`npm view <name>`).
- Handle the outer wrap error (error 16) and inspect its cause string for this message.
Example fix
// before node install-run.js pnpm@^99.0.0 -- pnpm -v // after: use a range that matches published versions node install-run.js pnpm@8 -- pnpm -v
Defensive patterns
Strategy: validation
Validate before calling
const range = '8';
const { execSync } = require('child_process');
const out = JSON.parse(execSync(`npm view pnpm@${range} version --json`).toString());
if (!(Array.isArray(out) ? out.length : out)) throw new Error(`range ${range} matches no published version`); Try / catch
try { runInstall(); } catch (e) { if (/No versions found for the specified version range/.test(e.message) || /Unable to resolve version.*No versions found/.test(e.message)) { console.error('Use a valid semver range; list versions with npm view <pkg> versions'); process.exit(2); } throw e; } Prevention
- Resolve ranges with `npm view <pkg> versions --json` before use
- Pin exact versions for reproducible CI
- Beware of ranges against unpublished or renamed packages
When it happens
Trigger: npm view returned status 0 but an empty version list for the requested range, e.g. an exact version matching nothing, an invalid range string, or a package whose published versions don't satisfy the range.
Common situations: Requesting a not-yet-published version; typo'd semver range like "^ v1.2.3"; querying an npm dist-tag shape that returns empty; recently unpublished package.
Related errors
- No versions found for the specified version range.
- Unable to resolve version ${version} of package ${name}: ${e
- Unable to resolve version ${version} of package ${name}: ${e
- Invalid package specifier: ${rawPackageSpecifier}
- Unable to determine the path to the NPM tool: ${e}
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/df265f7704bbbedc.
Report an issue: GitHub.