hcengineering/platform · error · Error
Unable to find ${RUSH_JSON_FILENAME}.
Error message
Unable to find ${RUSH_JSON_FILENAME}. What it means
findRushJsonFolder walks up from the current directory toward the filesystem root looking for rush.json, caching the result. If it reaches the disk root without finding rush.json, it throws 'Unable to find rush.json'. The library throws this because install-run must know the repo root to locate common/temp and the package install folder.
Source
Thrown at foundations/core/common/scripts/install-run.js:548
/**
* 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 {
basePath = tempPath;
}
} while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root
if (!_rushJsonFolder) {
throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`);
}
}
return _rushJsonFolder;
}
/**
* Detects if the package in the specified directory is installed
*/
function _isPackageAlreadyInstalled(packageInstallFolder) {
try {
const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);
if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(flagFilePath)) {
return false;
}
const fileContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(flagFilePath).toString();
return fileContents.trim() === process.version;
}
catch (e) {
return false;View on GitHub (pinned to 63e28dc964)
Solutions
- Run the script from within the Rush repository (a directory containing rush.json in itself or an ancestor).
- Verify rush.json exists at the repo root and was checked out (full clone, not a sparse/partial checkout).
- cd to a folder inside the repo before invoking install-run-rush.js / install-run.js.
- If the folder is genuinely a Rush root, confirm rush.json is committed and not gitignored.
Example fix
// before (run from outside repo) cd ~ && node repo/common/scripts/install-run-rush.js // after cd /path/to/rush-repo && node common/scripts/install-run-rush.js
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const path = require('path');
function assertInsideRushRepo(startDir) {
let dir = path.resolve(startDir);
while (true) {
if (fs.existsSync(path.join(dir, 'rush.json'))) return dir;
const parent = path.dirname(dir);
if (parent === dir) throw new Error('rush.json not found; run from inside a Rush repo');
dir = parent;
}
}
assertInsideRushRepo(process.cwd()); Type guard
function isRushJsonFolder(dir) {
const fs = require('fs'); const path = require('path');
return typeof dir === 'string' && fs.existsSync(path.join(dir, 'rush.json'));
} Try / catch
try {
installAndRun(logger, name, version, bin, args);
} catch (e) {
if (/Unable to find rush\.json/.test(e.message)) {
console.error('Run this script from within a Rush monorepo (rush.json must exist in an ancestor folder).');
}
throw e;
} Prevention
- Always invoke install-run scripts from inside the Rush repo checkout
- Ensure full checkouts in CI (avoid sparse checkout dropping rush.json)
- Keep rush.json committed at the repo root
- Add a pre-flight check that rush.json exists before bootstrap scripts run
When it happens
Trigger: Running (or importing) install-run.js from a directory that is not inside a Rush monorepo, or from a subfolder whose ancestor chain contains no rush.json; the script was copied out of the repo and executed elsewhere.
Common situations: CI job checking out only a subdirectory of the repo; running the script from $HOME or a temp dir; rush.json renamed/moved or repo root misconfigured; invoking the script outside the monorepo during local debugging.
Related errors
- Unable to determine the required version of Rush from ${RUSH
- 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/09cf94b5ee5f2906.
Report an issue: GitHub.