hcengineering/platform · 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 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.

Source

Thrown at foundations/server/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 the path in the message and fix permissions on it (chmod/chown or run as the right user)
  2. Set RUSH_TEMP_FOLDER to a writable absolute path to override the default under ~/.rush
  3. Ensure HOME is set in CI containers (e.g. HOME=/tmp) so ~/.rush resolves
  4. Remove any file at that path that blocks directory creation, and free disk space if full

Example fix

// before (CI, HOME unset)
- run: node common/scripts/install-run-rush.js install
// after
- run: |
    export HOME=/tmp
    export RUSH_TEMP_FOLDER=/tmp/rush-temp
    node common/scripts/install-run-rush.js install
Defensive patterns

Strategy: try-catch

Validate before calling

const folder = process.env.RUSH_TEMP_FOLDER || require('os').homedir() + '/.rush';
fs.mkdirSync(folder, { recursive: true, mode: 0o755 });
fs.accessSync(folder, fs.constants.W_OK);

Type guard

function folderWritable(p) {
  try { fs.mkdirSync(p, { recursive: true }); fs.accessSync(p, fs.constants.W_OK); return true; } catch { return false; }
}

Try / catch

try {
  runRushInstall();
} catch (e) {
  if (String(e).includes('Error building local installation folder')) {
    console.error('Fix permissions or set RUSH_TEMP_FOLDER to a writable path:', e.message);
  } else throw e;
}

Prevention

When it happens

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

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

Related errors


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