hcengineering/platform · error · Error
Unable to determine the required version of Rush from ${RUSH
Error message
Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified using an unexpected syntax. What it means
This bootstrap script reads rush.json to find the required rushVersion via a regex, because rush.json supports comments that JSON.parse cannot handle. If the regex fails to match (no rushVersion field, or malformed/unexpected syntax), the catch block wraps any failure in this error so the launcher knows which Rush version to install.
Source
Thrown at foundations/core/common/scripts/install-run-rush.js:143
const RUSH_PREVIEW_VERSION = 'RUSH_PREVIEW_VERSION';
const INSTALL_RUN_RUSH_LOCKFILE_PATH_VARIABLE = 'INSTALL_RUN_RUSH_LOCKFILE_PATH';
function _getRushVersion(logger) {
const rushPreviewVersion = process.env[RUSH_PREVIEW_VERSION];
if (rushPreviewVersion !== undefined) {
logger.info(`Using Rush version from environment variable ${RUSH_PREVIEW_VERSION}=${rushPreviewVersion}`);
return rushPreviewVersion;
}
const rushJsonFolder = findRushJsonFolder();
const rushJsonPath = path__WEBPACK_IMPORTED_MODULE_0__.join(rushJsonFolder, RUSH_JSON_FILENAME);
try {
const rushJsonContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(rushJsonPath, 'utf-8');
// Use a regular expression to parse out the rushVersion value because rush.json supports comments,
// but JSON.parse does not and we don't want to pull in more dependencies than we need to in this script.
const rushJsonMatches = rushJsonContents.match(/\"rushVersion\"\s*\:\s*\"([0-9a-zA-Z.+\-]+)\"/);
return rushJsonMatches[1];
}
catch (e) {
throw new Error(`Unable to determine the required version of Rush from ${RUSH_JSON_FILENAME} (${rushJsonFolder}). ` +
`The 'rushVersion' field is either not assigned in ${RUSH_JSON_FILENAME} or was specified ` +
'using an unexpected syntax.');
}
}
function _getBin(scriptName) {
switch (scriptName.toLowerCase()) {
case 'install-run-rush-pnpm.js':
return 'rush-pnpm';
case 'install-run-rushx.js':
return 'rushx';
default:
return 'rush';
}
}
function _run() {
const [nodePath /* Ex: /bin/node */, scriptPath /* /repo/common/scripts/install-run-rush.js */, ...packageBinArgs /* [build, --to, myproject] */] = process.argv;
// Detect if this script was directly invoked, or if the install-run-rushx script was invokved to select the
// appropriate binary inside the rush package to runView on GitHub (pinned to 63e28dc964)
Solutions
- Open rush.json in the repo root and ensure a valid quoted field exists, e.g. "rushVersion": "5.x.x"
- Match the version syntax expected by the regex (letters, digits, dots, +, -) and keep it double-quoted with standard JSON spacing
- Run `rush update` or restore rush.json from version control if it was hand-edited
Example fix
// before (rush.json)
{ "folderPermanentName": "..." }
// after (rush.json)
{ "rushVersion": "5.100.1", ... } Defensive patterns
Strategy: validation
Validate before calling
const contents = fs.readFileSync('rush.json', 'utf8');
if (!/\"rushVersion\"\s*:\s*\"[0-9a-zA-Z.+\-]+\"/.test(contents)) throw new Error('rush.json is missing a valid quoted rushVersion field'); Try / catch
try { require('./common/scripts/install-run-rush.js'); }
catch (e) { if (/Unable to determine the required version of Rush/.test(e.message)) { console.error('Fix rush.json rushVersion field'); process.exit(1); } throw e; } Prevention
- Never hand-edit rush.json; let `rush update` manage it
- Keep rush.json in version control so it can be restored
- Validate rush.json after merges/upgrades that touch repo tooling
When it happens
Trigger: Running install-run-rush.js when rush.json has no "rushVersion" field, the field is not a quoted string (e.g. a number or missing quotes), or the file cannot be read/parsed in the catch-guarded block.
Common situations: Upgraded repos where rush.json schema changed; hand-edited rush.json that dropped rushVersion; running the script from a folder where the wrong/placeholder rush.json was found (e.g. no rush.json in repo root).
Related errors
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to determine the required version of Rush from ${RUSH
- Unable to determine the required version of Rush from ${RUSH
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/7f40a29f056095da.
Report an issue: GitHub.