{"record":{"id":"0549690132a48807","repo":"hcengineering/platform","slug":"error-building-local-installation-folder-path","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":"Error","httpStatus":null,"severity":"error","filePath":"foundations/communication/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/communication/common/scripts/install-run.js#L407-L443","documentation":"_ensureAndJoinPath builds a folder chain under a base folder, creating each segment with mkdirSync when missing. Any filesystem error (permission denied, path exists as a file, invalid name) inside the try block is wrapped as this error, naming the full target path and the underlying cause.","triggerScenarios":"Calling any path helper (_getRushTempFolder, rushRecyclerFolder, packageInstallFolder, rushCommonFolder) when the base folder or a segment cannot be created: parent exists as a file, read-only volume, permission denied, or path length/name limits exceeded.","commonSituations":"RUSH_TEMP_FOLDER env var pointing to a non-writable or file location; home directory or common/appdata folder read-only in CI containers; a file named like the target folder left behind by a previous failed run.","solutions":["Check/create the target path manually and fix permissions (mkdir -p, chown) before running.","Set RUSH_TEMP_FOLDER to a writable directory to override the default temp location.","Remove any file conflicting with the folder path.","Ensure the script runs as a user with write access to the home/common-appdata folder."],"exampleFix":"// before\nexport RUSH_TEMP_FOLDER=/nonexistent-ro/tmp\n// after\nexport RUSH_TEMP_FOLDER=\"$HOME/.cache/rush-temp\" && mkdir -p \"$RUSH_TEMP_FOLDER\"","handlingStrategy":"validation","validationCode":"const base = process.env.RUSH_TEMP_FOLDER || require('os').tmpdir();\nconst fs = require('fs');\nfs.accessSync(fs.existsSync(base) ? base : require('path').dirname(base), fs.constants.W_OK);","typeGuard":null,"tryCatchPattern":"try { runInstall(); } catch (e) { const m = /Error building local installation folder \\((.+)\\):/.exec(e.message); if (m) { console.error('Cannot create folder', m[1], '- check permissions/disk'); process.exit(1); } throw e; }","preventionTips":["Point RUSH_TEMP_FOLDER at a guaranteed-writable dir in CI","Never leave files where directories are expected in the temp chain","Watch for ENOSPC/EDQUOT (disk full/quota) in runner logs"],"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"}