{"record":{"id":"a427eb0ba56a9369","repo":"hcengineering/platform","slug":"error-building-local-installation-folder-path-a427eb","errorCode":null,"errorMessage":"Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}","messagePattern":"Error building local installation folder \\((.+?)\\): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/server/common/scripts/install-run.js","lineNumber":425,"sourceCode":"/**\n * Create missing directories under the specified base directory, and return the resolved directory.\n *\n * Does not support \".\" or \"..\" path segments.\n * Assumes the baseFolder exists.\n */\nfunction _ensureAndJoinPath(baseFolder, ...pathSegments) {\n    let joinedPath = baseFolder;\n    try {\n        for (let pathSegment of pathSegments) {\n            pathSegment = pathSegment.replace(/[\\\\\\/]/g, '+');\n            joinedPath = path__WEBPACK_IMPORTED_MODULE_3__.join(joinedPath, pathSegment);\n            if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(joinedPath)) {\n                fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(joinedPath);\n            }\n        }\n    }\n    catch (e) {\n        throw new Error(`Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}`);\n    }\n    return joinedPath;\n}\nfunction _getRushTempFolder(rushCommonFolder) {\n    const rushTempFolder = process.env[RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME];\n    if (rushTempFolder !== undefined) {\n        _ensureFolder(rushTempFolder);\n        return rushTempFolder;\n    }\n    else {\n        return _ensureAndJoinPath(rushCommonFolder, 'temp');\n    }\n}\n/**\n * Compare version strings according to semantic versioning.\n * Returns a positive integer if \"a\" is a later version than \"b\",\n * a negative integer if \"b\" is later than \"a\",\n * and 0 otherwise.","sourceCodeStart":407,"sourceCodeEnd":443,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/server/common/scripts/install-run.js#L407-L443","documentation":"_ensureAndJoinPath creates a folder chain (baseFolder + segments), making each level if missing. Any mkdir/filesystem failure is wrapped in this message, which helpfully includes the full joined path being built, followed by the underlying error.","triggerScenarios":"baseFolder or a parent is read-only (EACCES/EPERM); a file exists where a directory is needed (ENOTDIR/EEXIST edge); invalid path characters on Windows; disk full; path exceeds MAX_PATH on Windows without long-path support.","commonSituations":"RUSH_TEMP_FOLDER env var pointing at an unwritable/invalid location; ~/.rush used in a home-less CI container (HOME unset); shared rush recycler folder on a mounted read-only volume; antivirus locking the folder on Windows.","solutions":["Check the path in the message and fix permissions on it (chmod/chown or run as the right user)","Set RUSH_TEMP_FOLDER to a writable absolute path to override the default under ~/.rush","Ensure HOME is set in CI containers (e.g. HOME=/tmp) so ~/.rush resolves","Remove any file at that path that blocks directory creation, and free disk space if full"],"exampleFix":"// before (CI, HOME unset)\n- run: node common/scripts/install-run-rush.js install\n// after\n- run: |\n    export HOME=/tmp\n    export RUSH_TEMP_FOLDER=/tmp/rush-temp\n    node common/scripts/install-run-rush.js install","handlingStrategy":"try-catch","validationCode":"const folder = process.env.RUSH_TEMP_FOLDER || require('os').homedir() + '/.rush';\nfs.mkdirSync(folder, { recursive: true, mode: 0o755 });\nfs.accessSync(folder, fs.constants.W_OK);","typeGuard":"function folderWritable(p) {\n  try { fs.mkdirSync(p, { recursive: true }); fs.accessSync(p, fs.constants.W_OK); return true; } catch { return false; }\n}","tryCatchPattern":"try {\n  runRushInstall();\n} catch (e) {\n  if (String(e).includes('Error building local installation folder')) {\n    console.error('Fix permissions or set RUSH_TEMP_FOLDER to a writable path:', e.message);\n  } else throw e;\n}","preventionTips":["Ensure HOME is set (and writable) in CI containers; default to HOME=/tmp otherwise","Point RUSH_TEMP_FOLDER at a dedicated writable directory on ephemeral CI runners","Avoid read-only mounts and over-quota disks for rush temp/recycler folders","Watch Windows MAX_PATH limits; keep repo and temp paths short"],"tags":["filesystem","permissions","rush"],"backgroundTag":"mkdir-permission-denied","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}