{"record":{"id":"22762e4b4c8150d5","repo":"parcel-bundler/parcel","slug":"pnpm-failed-to-install-modules","errorCode":null,"errorMessage":"pnpm failed to install modules","messagePattern":"pnpm failed to install modules","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/package-manager/src/Pnpm.js","lineNumber":185,"sourceCode":"        logger.log({\n          origin: '@parcel/package-manager',\n          message: `Added ${addedCount} ${\n            removedCount > 0 ? `and removed ${removedCount} ` : ''\n          }packages via pnpm`,\n        });\n      }\n\n      // Since we succeeded, stderr might have useful information not included\n      // in the json written to stdout. It's also not necessary to log these as\n      // errors as they often aren't.\n      for (let message of stderr) {\n        logger.log({\n          origin: '@parcel/package-manager',\n          message,\n        });\n      }\n    } catch (e) {\n      throw new Error('pnpm failed to install modules');\n    }\n  }\n}\n\nfunction prefix(message: string): string {\n  return 'pnpm: ' + message;\n}\n\nregisterSerializableClass(`${pkg.version}:Pnpm`, Pnpm);\n","sourceCodeStart":167,"sourceCodeEnd":195,"githubUrl":"https://github.com/parcel-bundler/parcel/blob/59484858a1a0bcbb71f74088956bb437a2db6505/packages/core/package-manager/src/Pnpm.js#L167-L195","documentation":"Thrown by the Pnpm package installer when the pnpm install subprocess fails. Unlike the Npm and Yarn wrappers, this error discards the caught exception's message entirely — it throws a bare 'pnpm failed to install modules' string with no error details. This makes debugging harder since the original error context (stderr, exit code, exception message) is lost.","triggerScenarios":"install() is called on the Pnpm class, which spawns `pnpm install` as a child process. The promise from the process rejects (non-zero exit), and the catch block re-throws a generic message without the original error. The stderr was processed in the success path's loop but is not accessible in the catch block.","commonSituations":"pnpm store corruption or lockfile conflicts. Network issues reaching the registry. pnpm version incompatibility with the lockfile format. Permission errors on the pnpm store directory. Hoisting conflicts in a monorepo workspace.","solutions":["Run `pnpm install` manually in the terminal to see the actual error output (the Parcel wrapper swallows it).","Delete pnpm-lock.yaml and node_modules, then retry.","Clear the pnpm store: `pnpm store prune`.","Check pnpm version compatibility: `pnpm --version` and update if needed.","Report the lossy error message as a bug — the catch block should include e.message like the Npm and Yarn wrappers do."],"exampleFix":"// before: error message has no details\n// Error: pnpm failed to install modules\n\n// after: run manually to see real error\n// $ cd <project-root> && pnpm install\n// then fix the underlying issue shown in pnpm's own output","handlingStrategy":"try-catch","validationCode":"// Pre-flight: verify pnpm is available and store is healthy\nconst {execSync} = require('child_process');\n\nfunction preflightPnpm() {\n  try {\n    let version = execSync('pnpm --version', {encoding: 'utf8'}).trim();\n    if (!version) throw new Error('pnpm not found');\n  } catch {\n    throw new Error('pnpm is not installed or not on PATH');\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await pnpmInstaller.install({modules, saveDev, cwd, packagePath, fs});\n} catch (e) {\n  if (e.message === 'pnpm failed to install modules') {\n    // Error message is lossy — run pnpm manually for details\n    console.error('Run \"pnpm install\" manually to see the actual error');\n  } else {\n    throw e;\n  }\n}","preventionTips":["Run `pnpm install` manually before starting Parcel to surface errors with full output.","Keep pnpm-lock.yaml committed and consistent.","Run `pnpm store prune` periodically to clean the global store.","Ensure pnpm version matches what generated the lockfile."],"tags":["package-manager","pnpm","install-failure","subprocess","error-masking"],"backgroundTag":null,"analyzedSha":"59484858a1a0bcbb71f74088956bb437a2db6505","analyzedAt":"2026-08-13T04:06:35.925Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}