hcengineering/platform · error · Error

Error building local installation folder (${path__WEBPACK_IM

Error message

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

What it means

_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.

Source

Thrown at foundations/communication/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/create the target path manually and fix permissions (mkdir -p, chown) before running.
  2. Set RUSH_TEMP_FOLDER to a writable directory to override the default temp location.
  3. Remove any file conflicting with the folder path.
  4. Ensure the script runs as a user with write access to the home/common-appdata folder.

Example fix

// before
export RUSH_TEMP_FOLDER=/nonexistent-ro/tmp
// after
export RUSH_TEMP_FOLDER="$HOME/.cache/rush-temp" && mkdir -p "$RUSH_TEMP_FOLDER"
Defensive patterns

Strategy: validation

Validate before calling

const base = process.env.RUSH_TEMP_FOLDER || require('os').tmpdir();
const fs = require('fs');
fs.accessSync(fs.existsSync(base) ? base : require('path').dirname(base), fs.constants.W_OK);

Try / catch

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; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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