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

  1. cd into a folder inside your Rush monorepo (anywhere at or below the folder containing rush.json) and re-run
  2. Verify rush.json exists at the repo root and was not renamed/deleted
  3. If using rush.json variant names/monorepo restructuring, ensure the file is still named rush.json at the repo root
  4. 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

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


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/390f17a0d7e428bb. Report an issue: GitHub.