hcengineering/platform · error
Unable to find rush.json.
Error message
Unable to find rush.json.
What it means
findRushJsonFolder walks up from the current directory to the disk root looking for rush.json, caching the folder when found. If the loop completes without finding rush.json, it throws 'Unable to find rush.json.' The script must be run inside a Rush monorepo.
Source
Thrown at foundations/utils/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
- cd into a folder inside your Rush monorepo (anywhere at or below the folder containing rush.json) and re-run
- Verify rush.json exists at the repo root and was not renamed/deleted
- If using rush.json variant names/monorepo restructuring, ensure the file is still named rush.json at the repo root
- Clone the full repository, not a partial subtree
Example fix
// before cd ~ && node /path/to/repo/common/scripts/install-run.js pnpm install // after cd /path/to/repo # contains rush.json node common/scripts/install-run.js pnpm install
Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const path = require('path');
function findRushJsonDir(startDir) {
let dir = startDir;
while (true) {
if (fs.existsSync(path.join(dir, 'rush.json'))) return dir;
const parent = path.dirname(dir);
if (parent === dir) throw new Error(`Not inside a Rush repo (no rush.json above ${startDir})`);
dir = parent;
}
}
process.chdir(findRushJsonDir(process.cwd())); // run from inside the monorepo Try / catch
try {
installAndRun(/* ... */);
} catch (e) {
if (e.message.includes('Unable to find rush.json')) {
console.error('Run this script from inside a Rush monorepo checkout.');
process.exit(1);
}
throw e;
} Prevention
- Only invoke install-run.js from a directory inside a Rush monorepo
- Do not delete or rename rush.json at the repo root
- Clone the whole repository rather than a subfolder
When it happens
Trigger: Running install-run.js (or the checked-in install-run/run scripts that call it) from a directory outside any folder containing rush.json.
Common situations: Running the bootstrap script from the home directory or a random temp folder; cloning only a subfolder of the monorepo; deleting or renaming rush.json; running from a non-Rush repo.
Related errors
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to determine the required version of Rush from ${RUSH
- Unable to find ${RUSH_JSON_FILENAME}.
- Unable to find ${RUSH_JSON_FILENAME}.
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/390f17a0d7e428bb.
Report an issue: GitHub.