hcengineering/platform · error

Error building local installation folder (${join(baseFolder,

Error message

Error building local installation folder (${join(baseFolder, ...pathSegments)}): ${e}

What it means

_ensureAndJoinPath builds and creates a directory under a base folder (creating each segment with mkdirSync if missing). Any failure in creating or stat-ing the joined path is wrapped in this error, which names the full target path and the underlying cause. Callers use it for the rush temp folder, rush-recycler folder, package install folder, and rush common folder.

Source

Thrown at foundations/utils/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

  1. Check permissions on the base folder and ensure the process user can create directories there
  2. Set RUSH_TEMP_FOLDER to a writable location (e.g. a temp dir) via process env
  3. Free disk space if the disk is full
  4. Check the wrapped cause (`... : ${e}`) in the message to identify the exact fs error (EACCES/ENOSPC/EEXIST)

Example fix

// before
RUSH_TEMP_FOLDER=/mnt/readonly/tmp
// after
export RUSH_TEMP_FOLDER="$(mktemp -d)"
Defensive patterns

Strategy: validation

Validate before calling

const fs = require('fs');
function assertWritableDir(base) {
  fs.mkdirSync(base, { recursive: true });
  fs.accessSync(base, fs.constants.W_OK);
}
assertWritableDir(process.env.RUSH_TEMP_FOLDER || require('path').join(repoRoot, 'common', 'temp'));

Try / catch

try {
  installAndRun(/* ... */);
} catch (e) {
  if (String(e.message).startsWith('Error building local installation folder')) {
    console.error('Check RUSH_TEMP_FOLDER and folder permissions:', e.message);
    process.exit(1);
  }
  throw e;
}

Prevention

When it happens

Trigger: mkdirSync fails (EACCES, EPERM, EEXIST race, ENOSPC) or existsSync throws while constructing rush temp/common/recycler/package-install folders via _getRushTempFolder, rushRecyclerFolder, packageInstallFolder, or rushCommonFolder.

Common situations: RUSH_TEMP_FOLDER env var points to a read-only or nonexistent drive; running in a container as non-root without write access to the repo's common/ folder; disk full; antivirus locking the directory during creation.

Related errors


AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29). Data as JSON: /api/errors/06657b50012a59fc. Report an issue: GitHub.