{"record":{"id":"3a180d03a1185f56","repo":"vercel/turborepo","slug":"package-manager-could-not-be-found","errorCode":"package_manager-could_not_be_found","errorMessage":"${convertTo.name} is not installed, or could not be located","messagePattern":"(.+?) is not installed, or could not be located","errorType":"exception","errorClass":"ConvertError","httpStatus":null,"severity":"error","filePath":"packages/turbo-workspaces/src/convert.ts","lineNumber":47,"sourceCode":"}: {\n  project: Project;\n  convertTo: RequestedPackageManagerDetails;\n  logger: Logger;\n  options?: Options;\n}) {\n  logger.header(\n    `Converting project from ${project.packageManager} to ${convertTo.name}.`\n  );\n\n  if (!options?.ignoreUnchangedPackageManager) {\n    if (project.packageManager === convertTo.name) {\n      throw new ConvertError(\"You are already using this package manager\", {\n        type: \"package_manager-already_in_use\"\n      });\n    }\n\n    if (!convertTo.version) {\n      throw new ConvertError(\n        `${convertTo.name} is not installed, or could not be located`,\n        {\n          type: \"package_manager-could_not_be_found\"\n        }\n      );\n    }\n  }\n\n  // this cast is safe since we've just verified that the version exists above\n  const to = convertTo as AvailablePackageManagerDetails;\n\n  // remove old workspace data\n  if (!options?.ignoreUnchangedPackageManager) {\n    await MANAGERS[project.packageManager].remove({\n      project,\n      to,\n      logger,\n      options","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/vercel/turborepo/blob/f9245100cf0d31d96628804ead485f6bf226e55a/packages/turbo-workspaces/src/convert.ts#L29-L65","documentation":"convert requires the target package manager to be resolvable on the machine: convertTo.version is populated only when the binary was located (version detection). If it is missing, conversion aborts with ConvertError type package_manager-could_not_be_found, because later steps must run the target manager's install command.","triggerScenarios":"Calling convert with a convertTo whose binary is not installed or not on PATH (e.g. converting to yarn/pnpm/bun without it installed), the binary existing only under a name not probed, or PATH being minimal (cron, stripped CI containers) so which/execa cannot find it.","commonSituations":"CI images that preinstall npm but not pnpm/bun, converting on a machine where the target was installed via a version manager that is not on PATH for the current shell, Windows where the .cmd shim is missing, or corepack not enabled for yarn/pnpm.","solutions":["Install the target manager: corepack enable && corepack prepare pnpm@latest --activate (or npm i -g pnpm / curl -fsSL https://bun.sh/install | bash)","Verify from the same shell/environment: <pm> --version resolves","If using a version manager (volta, asdf, mise), ensure its shims are on PATH for the process calling convert","On CI, add the install step before the convert step"],"exampleFix":"# before\nnpx @turbo/workspaces convert --to pnpm # pnpm not installed -> throws\n\n# after\nnpm i -g pnpm && pnpm --version\nnpx @turbo/workspaces convert --to pnpm","handlingStrategy":"validation","validationCode":"import { execa } from \"execa\";\n\nasync function managerInstalled(name: string): Promise<boolean> {\n  try {\n    await execa(name, [\"--version\"]);\n    return true;\n  } catch {\n    return false;\n  }\n}\n// if (!(await managerInstalled(target.name))) install or abort before convert;","typeGuard":null,"tryCatchPattern":"try {\n  await convert({ project, convertTo, logger });\n} catch (err) {\n  if (err instanceof ConvertError && err.type === \"package_manager-could_not_be_found\") {\n    throw new Error(`Install ${convertTo.name} first (corepack or global install)`, { cause: err });\n  }\n  throw err;\n}","preventionTips":["Install and verify the target manager (pm --version) in the same shell that runs convert","Enable corepack for yarn/pnpm in CI images","Export version-manager shims (volta/mise/asdf) on PATH for automation processes"],"tags":["package-manager","convert","environment","path","turbo-workspaces"],"backgroundTag":"package-manager-not-found","analyzedSha":"f9245100cf0d31d96628804ead485f6bf226e55a","analyzedAt":"2026-08-17T10:46:15.696Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}