{"record":{"id":"a5b505fd0e160ae8","repo":"hcengineering/platform","slug":"unable-to-install-package-e","errorCode":null,"errorMessage":"Unable to install package: ${e}","messagePattern":"Unable to install package: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"foundations/communication/common/scripts/install-run.js","lineNumber":649,"sourceCode":" */\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`);\n        }\n        logger.info(`Successfully installed ${name}@${version}`);\n    }\n    catch (e) {\n        throw new Error(`Unable to install package: ${e}`);\n    }\n}\n/**\n * Get the \".bin\" path for the package.\n */\nfunction _getBinPath(packageInstallFolder, binName) {\n    const binFolderPath = path__WEBPACK_IMPORTED_MODULE_3__.resolve(packageInstallFolder, NODE_MODULES_FOLDER_NAME, '.bin');\n    const resolvedBinName = _isWindows() ? `${binName}.cmd` : binName;\n    return path__WEBPACK_IMPORTED_MODULE_3__.resolve(binFolderPath, resolvedBinName);\n}\n/**\n * Returns a cross-platform path - windows must enclose any path containing spaces within double quotes.\n */\nfunction _getPlatformPath(platformPath) {\n    return _isWindows() && platformPath.includes(' ') ? `\"${platformPath}\"` : platformPath;\n}\nfunction _isWindows() {\n    return os__WEBPACK_IMPORTED_MODULE_2__.platform() === 'win32';","sourceCodeStart":631,"sourceCodeEnd":667,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/foundations/communication/common/scripts/install-run.js#L631-L667","documentation":"Catch-all wrapper in install-run.js: any exception thrown while preparing or installing the requested package (spawn failure, npm missing, ENOSPC, etc.) is rethrown as `Unable to install package: ${e}` with the original error stringified into the message. Unlike error 20, this covers the whole try/catch, including cases where npm could not even be spawned.","triggerScenarios":"Calling installAndRun/install-run-rush.js when the underlying installation step throws for any reason — npm binary not found, permission errors on the temp folder, or the non-zero-exit error from the inner block being caught and re-wrapped.","commonSituations":"Windows/CI environments where npm is not on PATH; read-only common/temp folder; recursive bootstrap scripts failing mid-way; the message often shows `Error: \"npm install\" encountered an error` nested inside.","solutions":["Inspect the nested message after the colon — it contains the original cause to act on.","Ensure npm/node are on PATH and the script is executed with a compatible Node version.","Delete the rush temp install folder (common/temp/install-run) to clear a corrupted partial install and retry.","Check filesystem permissions and disk space for the rush 'common' temp directory.","Verify package name/version and registry access as with the inner npm error."],"exampleFix":"// before (CI log)\nError: Unable to install package: Error: \"npm install\" encountered an error\n// after: ensure npm is available and spec is valid before bootstrapping\nwhich npm && node common/scripts/install-run-rush.js pnpm@7.33.6 pnpm install","handlingStrategy":"try-catch","validationCode":"if (!process.env.PATH || !['node', 'npm'].every(b => require('child_process').execSync(`which ${b}`, { stdio: 'ignore' }))) {\n  throw new Error('node/npm must be on PATH before running install-run')\n}","typeGuard":null,"tryCatchPattern":"try {\n  require('./common/scripts/install-run-rush.js')\n} catch (e) {\n  console.error('Bootstrap failed:', e.message)\n  process.exit(1)\n}","preventionTips":["Ensure npm and node are on PATH and versions match Rush's requirements.","Keep common/temp writable and clean corrupted partial installs.","Unwrap the nested cause after 'Unable to install package:' to find the root error.","Check disk space and permissions in CI containers."],"tags":["npm","rush","install","bootstrap","wrapper"],"backgroundTag":"npm-install-failed","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}