vercel/next.js · error · Error

Failed to get registry from

Error message

Failed to get registry from "${pkgManager}".

What it means

Wraps the failure of running `<pkgManager> config get registry` via execSync while resolving the npm registry URL for downloading optional SWC dependencies. The original exec error is attached as cause; typical triggers are an unknown package manager name or a broken package manager installation on PATH.

Solutions

  1. Ensure the package manager is installed and on PATH; set the registry explicitly if config query fails.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Querying the package manager for its registry fails.

Common situations: npm/yarn/pnpm config get registry fails due to a broken package manager installation.


AI-assisted analysis of vercel/next.js@0eb3775416 (2026-08-19). Data as JSON: /api/errors/eea071dd9dd250ae. Report an issue: GitHub.

Appendix: source

Thrown at packages/next/src/lib/helpers/get-registry.ts:37

  try {
    const output = execSync(
      `${pkgManager} config get registry ${resolvedFlags}`,
      {
        env: {
          ...process.env,
          NODE_OPTIONS: getFormattedNodeOptionsWithoutInspect(),
        },
      }
    )
      .toString()
      .trim()

    if (output.startsWith('http')) {
      registry = output.endsWith('/') ? output : `${output}/`
    }
  } catch (err) {
    throw new Error(`Failed to get registry from "${pkgManager}".`, {
      cause: err,
    })
  }

  return registry
}

View on GitHub (pinned to 0eb3775416)