hcengineering/platform · error · Error
Unable to resolve version ${version} of package ${name}: ${e
Error message
Unable to resolve version ${version} of package ${name}: ${e} What it means
_resolvePackageVersion wraps its entire body in try/catch; any failure — spawn failure, JSON parse error, the "No versions found" throw — is rethrown as "Unable to resolve version ${version} of package ${name}: ${e}". This is the error callers actually see; the original cause is appended after the colon.
Source
Thrown at foundations/communication/common/scripts/install-run.js:525
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);
if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) {
_rushJsonFolder = basePath;
break;
}
else {View on GitHub (pinned to 63e28dc964)
Solutions
- Read the cause after the colon and address the underlying error (network, auth, range).
- Pin an exact published version to bypass range resolution (`npm view <name> versions` to list).
- Retry if the cause indicates a transient registry/network failure.
- Ensure the version argument passed to the script is a valid semver range or tag.
Example fix
// before node install-run.js pnpm@latest-beta -- pnpm -v # invalid tag/parse issue // after node install-run.js "pnpm@^8.15.0" -- pnpm -v
Defensive patterns
Strategy: try-catch
Try / catch
try { runInstall(); } catch (e) { if (/Unable to resolve version .+ of package .+/.test(e.message)) { console.error('Version resolution failed:', e.message); /* inspect cause after the colon; retry on network causes */ } else throw e; } Prevention
- Read the embedded cause after the colon to pick the right fix
- Retry on transient network causes; fix auth/range on deterministic causes
- Pin exact versions to minimize resolution surface
When it happens
Trigger: Any failure inside _resolvePackageVersion while resolving the package version passed to the install-run script: npm view nonzero exit, invalid JSON output, empty version list, or a network/registry error.
Common situations: Registry outages or proxy blocks in CI; private packages without auth; malformed version specifiers; npm emitting warnings/deprecation text that breaks --json parsing.
Related errors
- "npm view" returned error code ${npmVersionSpawnResult.statu
- No versions found for the specified version range.
- "npm view" returned error code ${npmVersionSpawnResult.statu
- "npm view" returned error code ${npmVersionSpawnResult.statu
- "npm ${command}" encountered an error
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/517f4e211bbde6b1.
Report an issue: GitHub.