google/zx · error · Fail

Unsupported installer type: ${installerType}. Supported type

Error message

Unsupported installer type: ${installerType}. Supported types: ${Object.keys(installers).join(', ')}

What it means

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.

Source

Thrown at src/deps.ts:38

 * Install npm dependencies
 * @param dependencies object of dependencies
 * @param prefix  path to the directory where npm should install the dependencies
 * @param registry custom npm registry URL when installing dependencies
 * @param installerType package manager: npm, yarn, pnpm, bun, etc.
 */
export async function installDeps(
  dependencies: Record<string, string>,
  prefix?: string,
  registry?: string,
  installerType = 'npm'
): Promise<void> {
  const installer = installers[installerType]
  const packages = Object.entries(dependencies).map(
    ([name, version]) => `${name}@${version}`
  )
  if (packages.length === 0) return
  if (!installer) {
    throw new Fail(
      `Unsupported installer type: ${installerType}. Supported types: ${Object.keys(installers).join(', ')}`
    )
  }

  await spinner(`${installerType} i ${packages.join(' ')}`, () =>
    installer({ packages, prefix, registry })
  )
}

type DepsInstaller = (opts: {
  packages: string[]
  registry?: string
  prefix?: string
}) => Promise<void>

const installers: Record<any, DepsInstaller> = {
  npm: async ({ packages, prefix, registry }) => {
    const flags = [

View on GitHub (pinned to 00a2c484e2)

Solutions

  1. Use the default installer by omitting installerType (defaults to 'npm').
  2. Install deps yourself with the pm of choice via `$\`pnpm install\`` instead of installDeps.
  3. Check the supported set at runtime: `Object.keys(installers)` before calling.
  4. Register a custom installer in the installers map if the API surface allows it.

Example fix

// before
installDeps(deps, cwd, registry, 'pnpm')
// after: run the pm directly, or fall back to the default npm installer
await $`pnpm install`
//   or
await installDeps(deps, cwd, registry)  // uses 'npm'
Defensive patterns

Strategy: validation

Validate before calling

// As shipped only 'npm' is registered.
const SUPPORTED_INSTALLERS = ['npm']

function isSupportedInstaller(t: string): boolean {
  return SUPPORTED_INSTALLERS.includes(t)
}

if (!isSupportedInstaller(pm)) {
  throw new Error(`Unsupported installer: ${pm}; run \`${pm} install\` directly`)
}

Type guard

type InstallerType = 'npm'
const isInstallerType = (v: string): v is InstallerType =>
  v === 'npm'

Try / catch

try {
  await installDeps(deps, cwd, registry, pm)
} catch (e) {
  if (e instanceof Fail && /Unsupported installer type/.test(e.message)) {
    await $`${pm} install`
  } else throw e
}

Prevention

When it happens

Trigger: `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.

Common situations: 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.


AI-assisted analysis of google/zx@00a2c484e2 (2026-08-13). Data as JSON: /api/errors/f2710f814fed4d41. Report an issue: GitHub.