{"record":{"id":"f2710f814fed4d41","repo":"google/zx","slug":"unsupported-installer-type-installertype-supp","errorCode":null,"errorMessage":"Unsupported installer type: ${installerType}. Supported types: ${Object.keys(installers).join(', ')}","messagePattern":"Unsupported installer type: (.+?)\\. Supported types: (.+?)","errorType":"exception","errorClass":"Fail","httpStatus":null,"severity":"error","filePath":"src/deps.ts","lineNumber":38,"sourceCode":" * Install npm dependencies\n * @param dependencies object of dependencies\n * @param prefix  path to the directory where npm should install the dependencies\n * @param registry custom npm registry URL when installing dependencies\n * @param installerType package manager: npm, yarn, pnpm, bun, etc.\n */\nexport async function installDeps(\n  dependencies: Record<string, string>,\n  prefix?: string,\n  registry?: string,\n  installerType = 'npm'\n): Promise<void> {\n  const installer = installers[installerType]\n  const packages = Object.entries(dependencies).map(\n    ([name, version]) => `${name}@${version}`\n  )\n  if (packages.length === 0) return\n  if (!installer) {\n    throw new Fail(\n      `Unsupported installer type: ${installerType}. Supported types: ${Object.keys(installers).join(', ')}`\n    )\n  }\n\n  await spinner(`${installerType} i ${packages.join(' ')}`, () =>\n    installer({ packages, prefix, registry })\n  )\n}\n\ntype DepsInstaller = (opts: {\n  packages: string[]\n  registry?: string\n  prefix?: string\n}) => Promise<void>\n\nconst installers: Record<any, DepsInstaller> = {\n  npm: async ({ packages, prefix, registry }) => {\n    const flags = [","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/google/zx/blob/00a2c484e219c2e84bfc3a199febf7fbce2cfbf4/src/deps.ts#L20-L56","documentation":"Thrown by installDeps() when installerType is not a key in the internal `installers` registry. As shipped, only `'npm'` is registered, so any other value (yarn, pnpm, bun, a typo, wrong casing) throws — even though the JSDoc mentions yarn/pnpm/bun. The message lists the actually-supported keys.","triggerScenarios":"`installDeps(deps, cwd, reg, 'yarn')`; `'pnpm'` or `'bun'`; a typo like 'Npm'; passing a user-configured package-manager name from a CLI/programmatic call into installDeps.","commonSituations":"Projects standardized on pnpm/yarn/bun calling installDeps with their package manager; monorepo tooling forwarding the pm name; assuming the docs list equals the supported set.","solutions":["Use the default installer by omitting installerType (defaults to 'npm').","Install deps yourself with the pm of choice via `$\\`pnpm install\\`` instead of installDeps.","Check the supported set at runtime: `Object.keys(installers)` before calling.","Register a custom installer in the installers map if the API surface allows it."],"exampleFix":"// before\ninstallDeps(deps, cwd, registry, 'pnpm')\n// after: run the pm directly, or fall back to the default npm installer\nawait $`pnpm install`\n//   or\nawait installDeps(deps, cwd, registry)  // uses 'npm'","handlingStrategy":"validation","validationCode":"// As shipped only 'npm' is registered.\nconst SUPPORTED_INSTALLERS = ['npm']\n\nfunction isSupportedInstaller(t: string): boolean {\n  return SUPPORTED_INSTALLERS.includes(t)\n}\n\nif (!isSupportedInstaller(pm)) {\n  throw new Error(`Unsupported installer: ${pm}; run \\`${pm} install\\` directly`)\n}","typeGuard":"type InstallerType = 'npm'\nconst isInstallerType = (v: string): v is InstallerType =>\n  v === 'npm'","tryCatchPattern":"try {\n  await installDeps(deps, cwd, registry, pm)\n} catch (e) {\n  if (e instanceof Fail && /Unsupported installer type/.test(e.message)) {\n    await $`${pm} install`\n  } else throw e\n}","preventionTips":["Omit installerType to use the default 'npm'.","For pnpm/yarn/bun, run the install command via $ directly instead of installDeps.","Do not trust the JSDoc list — check Object.keys(installers) for the real supported set."],"tags":["deps","installer","package-manager","npm"],"backgroundTag":null,"analyzedSha":"00a2c484e219c2e84bfc3a199febf7fbce2cfbf4","analyzedAt":"2026-08-13T02:11:06.305Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}