hcengineering/platform · error
Error building local installation folder (${path.join(baseFo
Error message
Error building local installation folder (${path.join(baseFolder, ...pathSegments)}): ${e} What it means
_ensureAndJoinPath builds a directory chain under a base folder, creating each segment with mkdirSync if missing, and wraps any fs error in this Error naming the full joined path. It underpins the rush temp/recycler/package-install/common folders, so a failure here aborts the bootstrap before npm can run.
Source
Thrown at foundations/net/common/scripts/install-run.js:425
/**
* Create missing directories under the specified base directory, and return the resolved directory.
*
* Does not support "." or ".." path segments.
* Assumes the baseFolder exists.
*/
function _ensureAndJoinPath(baseFolder, ...pathSegments) {
let joinedPath = baseFolder;
try {
for (let pathSegment of pathSegments) {
pathSegment = pathSegment.replace(/[\\\/]/g, '+');
joinedPath = path__WEBPACK_IMPORTED_MODULE_3__.join(joinedPath, pathSegment);
if (!fs__WEBPACK_IMPORTED_MODULE_1__.existsSync(joinedPath)) {
fs__WEBPACK_IMPORTED_MODULE_1__.mkdirSync(joinedPath);
}
}
}
catch (e) {
throw new Error(`Error building local installation folder (${path__WEBPACK_IMPORTED_MODULE_3__.join(baseFolder, ...pathSegments)}): ${e}`);
}
return joinedPath;
}
function _getRushTempFolder(rushCommonFolder) {
const rushTempFolder = process.env[RUSH_TEMP_FOLDER_ENV_VARIABLE_NAME];
if (rushTempFolder !== undefined) {
_ensureFolder(rushTempFolder);
return rushTempFolder;
}
else {
return _ensureAndJoinPath(rushCommonFolder, 'temp');
}
}
/**
* Compare version strings according to semantic versioning.
* Returns a positive integer if "a" is a later version than "b",
* a negative integer if "b" is later than "a",
* and 0 otherwise.View on GitHub (pinned to 63e28dc964)
Solutions
- Set RUSH_TEMP_FOLDER to a writable directory to relocate the temp root.
- Check ownership/permissions of ~/.rush and <repo>/common/temp; chown/chmod (fix dirs previously created with sudo: sudo chown -R $(whoami) ~/.rush).
- Remove a conflicting file at the reported joined path so mkdir can create a folder there.
- Free disk space or remount the volume read-write if the cause is ENOSPC/EROFS.
Example fix
// before sudo rush install # creates ~/.rush owned by root rush install # Error building local installation folder (/home/me/.rush/...): EACCES // after sudo chown -R $(whoami) ~/.rush rush install
Defensive patterns
Strategy: validation
Validate before calling
const base = process.env.RUSH_TEMP_FOLDER ?? path.join(os.homedir(), '.rush')
fs.mkdirSync(base, { recursive: true })
fs.accessSync(base, fs.constants.W_OK) // throws EACCES early with a clear path Try / catch
try {
ensureRushFolders()
} catch (e) {
if (e.message.startsWith('Error building local installation folder')) {
const p = e.message.match(/\(([^)]+)\)/)?.[1]
console.error(`Cannot create ${p} — check ownership/permissions or set RUSH_TEMP_FOLDER`)
}
throw e
} Prevention
- Never run rush installs under sudo; if you did, chown ~/.rush back to your user.
- Point RUSH_TEMP_FOLDER at a known-writable dir in CI and containers.
- Ensure the target path is not occupied by a regular file before bootstrap.
- Monitor disk space on volumes hosting the rush temp folders.
When it happens
Trigger: _getRushTempFolder / rushRecyclerFolder / packageInstallFolder / rushCommonFolder call _ensureAndJoinPath and an fs operation fails: EACCES creating the folder, EPERM, path exists as a FILE (EEXIST/ENOTDIR), disk full, or read-only volume.
Common situations: RUSH_TEMP_FOLDER env var points somewhere unwritable; ~/rush or the repo's common/temp owned by root after a sudo run; the target path exists as a file; CI runners with read-only HOME.
Related errors
- Error building local installation folder (${path__WEBPACK_IM
- Unable to create installed.flag file in ${packageInstallFold
- Unable to create installed.flag file in ${packageInstallFold
- Error building local installation folder (${path__WEBPACK_IM
- Error cleaning the package install folder (${packageInstallF
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/7c762e0b02ae9398.
Report an issue: GitHub.