{"record":{"id":"9fa67ffdc8d64c03","repo":"hcengineering/platform","slug":"unable-to-find-rush-json-filename","errorCode":null,"errorMessage":"Unable to find ${RUSH_JSON_FILENAME}.","messagePattern":"Unable to find (.+?)\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"foundations/communication/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/communication/common/scripts/install-run.js#L530-L566","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["cd into the Rush monorepo root (or a subfolder of it) before running the script.","Verify rush.json exists at the repo root; restore it if deleted (check git status).","If the repo uses rush.jsonc, ensure the script/launcher version matches the Rush version that supports it.","Call the script's exported function with an explicit folder path if invoking programmatically."],"exampleFix":"// before\ncd /tmp && node install-run.js pnpm@8 -- pnpm install\n// after\ncd /path/to/rush-monorepo && node install-run.js pnpm@8 -- pnpm install","handlingStrategy":"validation","validationCode":"const fs = require('fs'), path = require('path');\nlet dir = process.cwd();\nwhile (true) {\n  if (fs.existsSync(path.join(dir, 'rush.json'))) break;\n  const parent = path.dirname(dir);\n  if (parent === dir) throw new Error('Not inside a Rush repo: rush.json not found; cd into the monorepo');\n  dir = parent;\n}","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Always cd to the monorepo root (or subfolder) before invoking","Keep rush.json committed; check git status after clones","Match script/launcher version to your Rush version (rush.json vs rush.jsonc support)"],"tags":["rush","configuration","monorepo"],"backgroundTag":"rush-json-not-found","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}