hcengineering/platform · error
Unable to resolve version
Error message
Unable to resolve version ${version} of package ${name}: ${e} What it means
This error is thrown by _resolvePackageVersion in install-run.js when the script cannot determine which concrete version of a package satisfies the requested version range. It wraps any failure from querying the npm registry (or a configured package manager registry) — including registry fetch failures, a non-200 response, invalid JSON, or the 'No versions found for the specified version range.' condition. The original error is appended to the message so the underlying cause is visible.
Solutions
- Check the wrapped cause in the message: fix the underlying registry/network/404 problem it reports.
- Verify the package name and version range are correct and that at least one published version satisfies the range (e.g. 'npm view <name> versions').
- Ensure the registry is reachable and, if private, that auth is configured (NODE_AUTH_TOKEN / .npmrc) in the environment running the script.
- Pin an exact existing version instead of a broad or incorrect range.
- Retry after transient registry/network failures or when CI connectivity is restored.
Example fix
// before node install-run-rush.js "@microsoft/rush" "^999.0.0" rebuild // after node install-run-rush.js "@microsoft/rush" "5.100.1" rebuild
Defensive patterns
Strategy: validation
Validate before calling
// Resolve the range against the registry before invoking the script
const { execSync } = require('child_process');
try {
const v = JSON.parse(execSync(`npm view ${name}@'${range}' version --json`, { encoding: 'utf8' }));
if (!v) throw new Error(`no version of ${name} satisfies ${range}`);
} catch (e) {
throw new Error(`Cannot pre-validate ${name}@${range}: ${e.message}`);
} Try / catch
try {
runInstallRun(name, versionRange);
} catch (e) {
if (String(e.message).startsWith('Unable to resolve version')) {
// fall back to a known-good pinned version or fail fast with guidance
console.error(`Bad range '${versionRange}': ${e.message}`);
process.exit(1);
}
throw e;
} Prevention
- Pin exact versions instead of open ranges in automation.
- Validate the range with 'npm view' in CI before running install-run.
- Configure registry auth (.npmrc) on CI before invoking the script.
- Wrap the whole install-run invocation in a retry for transient registry errors.
When it happens
Trigger: Calling installAndRun (or the install-run-RUSH entrypoint) with a version specifier that npm cannot resolve: a range matching no published versions, a typo'd package name (404 from registry), an unreachable/authorized-blocked registry, or a typo'd custom registry returning invalid data. Thrown from the catch block of the registry version query in _resolvePackageVersion.
Common situations: Running 'install-run-rush' in CI with a bad RUSH_VERSION pin; an internal npm registry outage or authentication requirement; a version range like '^999.0.0' that matches nothing; offline CI runners trying to resolve from the registry; typos in package name or version arguments.
Related errors
- Unable to resolve version
- No versions found for the specified version range.
- No versions found for the specified version range.
- No versions found for the specified version range.
- "npm " encountered an error
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/4c3e851d46481544.
Report an issue: GitHub.
Appendix: source
Thrown at foundations/net/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)