{"record":{"id":"d1878a543bd4d701","repo":"hcengineering/platform","slug":"unable-to-create-package-json-e-d1878a","errorCode":null,"errorMessage":"Unable to create package.json: ${e}","messagePattern":"Unable to create package\\.json: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"foundations/server/common/scripts/install-run.js","lineNumber":626,"sourceCode":"    }\n}\nfunction _createPackageJson(packageInstallFolder, name, version) {\n    try {\n        const packageJsonContents = {\n            name: 'ci-rush',\n            version: '0.0.0',\n            dependencies: {\n                [name]: version\n            },\n            description: \"DON'T WARN\",\n            repository: \"DON'T WARN\",\n            license: 'MIT'\n        };\n        const packageJsonPath = path__WEBPACK_IMPORTED_MODULE_3__.join(packageInstallFolder, PACKAGE_JSON_FILENAME);\n        fs__WEBPACK_IMPORTED_MODULE_1__.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContents, undefined, 2));\n    }\n    catch (e) {\n        throw new Error(`Unable to create package.json: ${e}`);\n    }\n}\n/**\n * Run \"npm install\" in the package install folder.\n */\nfunction _installPackage(logger, packageInstallFolder, name, version, command) {\n    try {\n        logger.info(`Installing ${name}...`);\n        const npmPath = getNpmPath();\n        const platformNpmPath = _getPlatformPath(npmPath);\n        const result = child_process__WEBPACK_IMPORTED_MODULE_0__.spawnSync(platformNpmPath, [command], {\n            stdio: 'inherit',\n            cwd: packageInstallFolder,\n            env: process.env,\n            shell: _isWindows()\n        });\n        if (result.status !== 0) {\n            throw new Error(`\"npm ${command}\" encountered an error`);","sourceCodeStart":608,"sourceCodeEnd":644,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/server/common/scripts/install-run.js#L608-L644","documentation":"_createPackageJson writes a minimal package.json (with the requested package as a dependency) into the temporary install folder using fs.writeFileSync. If the write fails for any reason, the error is wrapped as \"Unable to create package.json\". This is a hard prerequisite for the subsequent npm install step.","triggerScenarios":"The package install folder under common/temp/install-run does not exist, was removed concurrently, or is not writable; disk full; path length/permission issues on Windows.","commonSituations":"CI runners with read-only caches; another concurrent install-run process deleted the folder mid-run; disk quota exceeded on shared CI machines.","solutions":["Ensure common/temp exists and is writable by the current user","Clear common/temp/install-run and re-run to remove any half-deleted state","Free disk space or raise the quota on the CI machine","Avoid running multiple install-run invocations concurrently against the same repo temp folder"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const fs = require('fs')\nfs.mkdirSync('common/temp/install-run', { recursive: true })\nfs.accessSync('common/temp/install-run', fs.constants.W_OK)\nfs.accessSync('.', fs.constants.W_OK) // approximate disk writability check","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the repo temp folder exists and is writable before running install-run","Check free disk space in CI before install steps","Serialize install-run executions to avoid racing folder cleanup"],"tags":["rush","filesystem","npm","write-failure"],"backgroundTag":"filesystem-write-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}