hcengineering/platform · error
Unable to create installed.flag file in ${packageInstallFold
Error message
Unable to create installed.flag file in ${packageInstallFolder} What it means
After a successful install, _writeFlagFile writes installed.flag containing the current Node version so later runs can skip re-installation when the Node version is unchanged. If writing the flag file fails, this error is thrown, meaning the install succeeded but the caching marker could not be persisted.
Source
Thrown at foundations/server/common/scripts/install-run.js:678
/**
* Returns a cross-platform path - windows must enclose any path containing spaces within double quotes.
*/
function _getPlatformPath(platformPath) {
return _isWindows() && platformPath.includes(' ') ? `"${platformPath}"` : platformPath;
}
function _isWindows() {
return os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32';
}
/**
* Write a flag file to the package's install directory, signifying that the install was successful.
*/
function _writeFlagFile(packageInstallFolder) {
try {
const flagFilePath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, INSTALLED_FLAG_FILENAME);
fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(flagFilePath, process.version);
}
catch (e) {
throw new Error(`Unable to create installed.flag file in ${packageInstallFolder}`);
}
}
function installAndRun(logger, packageName, packageVersion, packageBinName, packageBinArgs, lockFilePath = process.env[INSTALL_RUN_LOCKFILE_PATH_VARIABLE]) {
const rushJsonFolder = findRushJsonFolder();
const rushCommonFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushJsonFolder, 'common');
const rushTempFolder = _getRushTempFolder(rushCommonFolder);
const packageInstallFolder = _ensureAndJoinPath(rushTempFolder, 'install-run', `${packageName}@${packageVersion}`);
if (!_isPackageAlreadyInstalled(packageInstallFolder)) {
// The package isn't already installed
_cleanInstallFolder(rushTempFolder, packageInstallFolder, lockFilePath);
const sourceNpmrcFolder = path__WEBPACK_IMPORTED_MODULE_3__.join(rushCommonFolder, 'config', 'rush');
(0,_utilities_npmrcUtilities__WEBPACK_IMPORTED_MODULE_4__.syncNpmrc)({
sourceNpmrcFolder,
targetNpmrcFolder: packageInstallFolder,
logger,
supportEnvVarFallbackSyntax: false
});
_createPackageJson(packageInstallFolder, packageName, packageVersion);View on GitHub (pinned to 63e28dc964)
Solutions
- Ensure common/temp/install-run and the package folder are writable; check disk space and quota
- Remove common/temp/install-run and re-run the script to rebuild the folder cleanly
- Avoid concurrent install-run executions for the same repo/lock combination
- On Windows, check antivirus/file-lock interference with the temp folder
Defensive patterns
Strategy: try-catch
Validate before calling
const fs = require('fs')
const dir = 'common/temp/install-run'
fs.mkdirSync(dir, { recursive: true })
fs.accessSync(dir, fs.constants.W_OK) Try / catch
try {
installAndRun(logger, pkg, version, bin, args)
} catch (e) {
if (e.message.startsWith('Unable to create installed.flag')) {
// install likely succeeded; check node_modules and clear flag state to retry cleanly
fs.rmSync('common/temp/install-run', { recursive: true, force: true })
installAndRun(logger, pkg, version, bin, args)
} else throw e
} Prevention
- Monitor disk space/quota on CI machines
- Avoid read-only mounts over common/temp
- Prevent concurrent install-run executions
When it happens
Trigger: fs.writeFileSync on common/temp/install-run/<pkg>/installed.flag fails due to missing folder, read-only filesystem, disk full, or AV/permission interference on Windows.
Common situations: Read-only CI workspace mounts; disk quota reached right after npm install filled the disk; two concurrent install-run runs racing to write the same flag file.
Related errors
- Error building local installation folder (${path__WEBPACK_IM
- Error cleaning the package install folder (${packageInstallF
- Unable to create installed.flag file in ${packageInstallFold
- Error building local installation folder (${path.join(baseFo
- Unable to create installed.flag file in ${packageInstallFold
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/857f8d32fa7bf11c.
Report an issue: GitHub.