hcengineering/platform · error · Error

Unable to find ${RUSH_JSON_FILENAME}.

Error message

Unable to find ${RUSH_JSON_FILENAME}.

What it means

findRushJsonFolder walks upward from the current directory to the disk root looking for rush.json and caches the result. If no rush.json is found in any ancestor, it throws this error. The install-run script requires being run inside (or under) a Rush monorepo.

Source

Thrown at foundations/communication/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 the Rush monorepo root (or a subfolder of it) before running the script.
  2. Verify rush.json exists at the repo root; restore it if deleted (check git status).
  3. If the repo uses rush.jsonc, ensure the script/launcher version matches the Rush version that supports it.
  4. Call the script's exported function with an explicit folder path if invoking programmatically.

Example fix

// before
cd /tmp && node install-run.js pnpm@8 -- pnpm install
// after
cd /path/to/rush-monorepo && node install-run.js pnpm@8 -- pnpm install
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs'), path = require('path');
let dir = process.cwd();
while (true) {
  if (fs.existsSync(path.join(dir, 'rush.json'))) break;
  const parent = path.dirname(dir);
  if (parent === dir) throw new Error('Not inside a Rush repo: rush.json not found; cd into the monorepo');
  dir = parent;
}

Try / catch

try { runInstall(); } catch (e) { if (/Unable to find rush\.json/.test(e.message)) { console.error('Run this from inside a Rush monorepo (rush.json must exist in an ancestor folder)'); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Running the install-run script (or the generated install-run-* launcher it produces) from a directory outside any Rush repository — no rush.json in the cwd or any parent.

Common situations: Running the script in a repo cloned without rush.json (deleted or renamed); running from $HOME or a temp dir; rush.json renamed to rush.jsonc in newer Rush versions while the script still looks for rush.json.

Related errors


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