{"record":{"id":"517f4e211bbde6b1","repo":"hcengineering/platform","slug":"unable-to-resolve-version-version-of-package","errorCode":null,"errorMessage":"Unable to resolve version ${version} of package ${name}: ${e}","messagePattern":"Unable to resolve version (.+?) of package (.+?): (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"foundations/communication/common/scripts/install-run.js","lineNumber":525,"sourceCode":"            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);\n            if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) {\n                _rushJsonFolder = basePath;\n                break;\n            }\n            else {","sourceCodeStart":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/communication/common/scripts/install-run.js#L507-L543","documentation":"_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.","triggerScenarios":"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.","commonSituations":"Registry outages or proxy blocks in CI; private packages without auth; malformed version specifiers; npm emitting warnings/deprecation text that breaks --json parsing.","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."],"exampleFix":"// before\nnode install-run.js pnpm@latest-beta -- pnpm -v   # invalid tag/parse issue\n// after\nnode install-run.js \"pnpm@^8.15.0\" -- pnpm -v","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["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"],"tags":["npm","network","versioning"],"backgroundTag":"version-resolution-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}