{"record":{"id":"390f17a0d7e428bb","repo":"hcengineering/platform","slug":"unable-to-find-rush-json","errorCode":null,"errorMessage":"Unable to find rush.json.","messagePattern":"Unable to find rush\\.json\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/utils/common/scripts/install-run.js","lineNumber":548,"sourceCode":"/**\n * Find the absolute path to the folder containing rush.json\n */\nfunction findRushJsonFolder() {\n    if (!_rushJsonFolder) {\n        let basePath = __dirname;\n        let tempPath = __dirname;\n        do {\n            const testRushJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(basePath, RUSH_JSON_FILENAME);\n            if (fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(testRushJsonPath)) {\n                _rushJsonFolder = basePath;\n                break;\n            }\n            else {\n                basePath = tempPath;\n            }\n        } while (basePath !== (tempPath = path__WEBPACK_IMPORTED_MODULE_3__.dirname(basePath))); // Exit the loop when we hit the disk root\n        if (!_rushJsonFolder) {\n            throw new Error(`Unable to find ${RUSH_JSON_FILENAME}.`);\n        }\n    }\n    return _rushJsonFolder;\n}\n/**\n * Detects if the package in the specified directory is installed\n */\nfunction _isPackageAlreadyInstalled(packageInstallFolder) {\n    try {\n        const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);\n        if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(flagFilePath)) {\n            return false;\n        }\n        const fileContents = fs__WEBPACK_IMPORTED_MODULE_1__.readFileSync(flagFilePath).toString();\n        return fileContents.trim() === process.version;\n    }\n    catch (e) {\n        return false;","sourceCodeStart":530,"sourceCodeEnd":566,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/utils/common/scripts/install-run.js#L530-L566","documentation":"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.","triggerScenarios":"Running install-run.js (or the checked-in install-run/run scripts that call it) from a directory outside any folder containing rush.json.","commonSituations":"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.","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"],"exampleFix":"// before\ncd ~ && node /path/to/repo/common/scripts/install-run.js pnpm install\n// after\ncd /path/to/repo   # contains rush.json\nnode common/scripts/install-run.js pnpm install","handlingStrategy":"validation","validationCode":"const fs = require('fs');\nconst path = require('path');\nfunction findRushJsonDir(startDir) {\n  let dir = startDir;\n  while (true) {\n    if (fs.existsSync(path.join(dir, 'rush.json'))) return dir;\n    const parent = path.dirname(dir);\n    if (parent === dir) throw new Error(`Not inside a Rush repo (no rush.json above ${startDir})`);\n    dir = parent;\n  }\n}\nprocess.chdir(findRushJsonDir(process.cwd())); // run from inside the monorepo","typeGuard":null,"tryCatchPattern":"try {\n  installAndRun(/* ... */);\n} catch (e) {\n  if (e.message.includes('Unable to find rush.json')) {\n    console.error('Run this script from inside a Rush monorepo checkout.');\n    process.exit(1);\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["rush","configuration","monorepo","missing-file"],"backgroundTag":"rush-json-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}