vercel/turborepo · error · Error

turbo@ does not exist

Error message

turbo@${to} does not exist

What it means

When you pass --to to turbo-codemod migrate, getLatestVersion resolves it against the npm registry. It first checks dist-tags such as latest or canary, then the published version list. It throws this Error when the value matches neither, so the requested turbo version does not exist.

Solutions

  1. List available versions and tags: npm view turbo versions --json and npm view turbo dist-tags --json
  2. Re-run migrate with an exact published version or a valid dist-tag such as latest or canary
  3. If you use a registry mirror, sync it or point npm_config_registry at the official registry
  4. Omit --to to let the codemod use the latest dist-tag

Example fix

# before
npm exec @turbo/codemod migrate --to 2.3.10
# after (after confirming the version exists)
npm exec @turbo/codemod migrate --to 2.3.1
Defensive patterns

Strategy: validation

Validate before calling

// confirm --to exists as a dist-tag or version before invoking the codemod
import { execSync } from "node:child_process";

function resolveTurboTarget(to: string): string {
  const tags = JSON.parse(execSync("npm view turbo dist-tags --json").toString());
  if (tags[to]) return tags[to];
  const versions = JSON.parse(execSync("npm view turbo versions --json").toString());
  if (versions.includes(to)) return to;
  throw new Error(`turbo@${to} does not exist`);
}

Type guard

function looksLikePublishedVersion(v: string, published: string[]): boolean {
  return published.includes(v);
}

Prevention

When it happens

Trigger: Running migrate with --to set to a version turbo never published, for example 99.0.0, or to a dist-tag name that does not exist. The fetched metadata contains neither the tag nor the version in its keys.

Common situations: Typos in the version string, such as 2.3.10 instead of 2.3.1. Guessing at a version that was never released. Using a custom registry mirror that is missing published versions. Passing a branch or commit name instead of a version.

Related errors


AI-assisted analysis of vercel/turborepo@f9245100cf (2026-08-17). Data as JSON: /api/errors/c81b4a107d84ae09. Report an issue: GitHub.

Appendix: source

Thrown at packages/turbo-codemod/src/commands/migrate/steps/get-latest-version.ts:42

    throw new Error(`Unable to fetch the latest version of ${packageName}`);
  }
}

export async function getLatestVersion({
  to
}: MigrateCommandOptions): Promise<string | undefined> {
  const packageDetails = await getPackageDetails({ packageName: "turbo" });
  const { "dist-tags": tags, versions } = packageDetails;

  if (to) {
    // If 'to' is a dist-tag (e.g. "latest", "canary"), resolve to the concrete version
    if (tags[to]) {
      return tags[to];
    }
    if (to in versions) {
      return to;
    }
    throw new Error(`turbo@${to} does not exist`);
  }

  return tags.latest;
}

View on GitHub (pinned to f9245100cf)