hcengineering/platform · error

Unable to find ${RUSH_JSON_FILENAME}.

Error message

Unable to find ${RUSH_JSON_FILENAME}.

What it means

Rush's install-run bootstrap script walks up from the script's directory looking for rush.json, the root marker of a Rush monorepo. If no rush.json is found anywhere up the directory tree, findRushJsonFolder throws this error because the script only works when run from inside a Rush repository. It caches the found folder in _rushJsonFolder after the first successful lookup.

Source

Thrown at foundations/server/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. Run the script from inside a Rush monorepo so a rush.json exists in the current directory or an ancestor
  2. Verify rush.json exists at the repo root (ls rush.json) and was not renamed or deleted; restore it if missing
  3. In CI, do a full checkout of the repo root before invoking install-run scripts, not just a subfolder
  4. If running from a copied script location, invoke it from the repo's common/scripts folder so __dirname is inside the repo

Example fix

// before (run from outside repo)
node /some/path/install-run.js qrcode ^1.2.0 qrcode
// after (cd into the Rush repo first)
cd /path/to/rush-repo && node common/scripts/install-run.js qrcode ^1.2.0 qrcode
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs'), path = require('path')
function assertInsideRushRepo(cwd = process.cwd()) {
  let dir = cwd
  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: rush.json not found')
    dir = parent
  }
}
assertInsideRushRepo()

Prevention

When it happens

Trigger: Running (or importing) install-run.js / install-run-rush.js / install-run-rushx.js from a directory that is not inside a Rush monorepo, or when the repo's root rush.json has been renamed, deleted, or moved. Also occurs when the script is copied out of the repo and executed standalone.

Common situations: CI jobs checking out only a subfolder of the monorepo (shallow/partial clone); running the bootstrap script from a machine's home directory or temp dir; scripts committed to common/scripts but the repo root rush.json missing due to bad checkout or a rename to rush.json5/rush variant.

Related errors


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