{"record":{"id":"1b90b7e5dc3d15a0","repo":"hcengineering/platform","slug":"unable-to-find-rush-json-filename-1b90b7","errorCode":null,"errorMessage":"Unable to find ${RUSH_JSON_FILENAME}.","messagePattern":"Unable to find (.+?)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/server/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/server/common/scripts/install-run.js#L530-L566","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Run the script from inside a Rush monorepo so a rush.json exists in the current directory or an ancestor","Verify rush.json exists at the repo root (ls rush.json) and was not renamed or deleted; restore it if missing","In CI, do a full checkout of the repo root before invoking install-run scripts, not just a subfolder","If running from a copied script location, invoke it from the repo's common/scripts folder so __dirname is inside the repo"],"exampleFix":"// before (run from outside repo)\nnode /some/path/install-run.js qrcode ^1.2.0 qrcode\n// after (cd into the Rush repo first)\ncd /path/to/rush-repo && node common/scripts/install-run.js qrcode ^1.2.0 qrcode","handlingStrategy":"validation","validationCode":"const fs = require('fs'), path = require('path')\nfunction assertInsideRushRepo(cwd = process.cwd()) {\n  let dir = cwd\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: rush.json not found')\n    dir = parent\n  }\n}\nassertInsideRushRepo()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run Rush bootstrap scripts from within the monorepo checkout","Verify rush.json exists at repo root in CI before running scripts","Use full checkouts (not partial subfolder checkouts) in CI"],"tags":["rush","monorepo","configuration","bootstrap"],"backgroundTag":"rush-json-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}