Skip to content

@clerk/upgrade --release=core-3 exits with an npm ERESOLVE error on Next.js 14 instead of saying Next 15 is required #10967

In progress

Description

@enismustafaj

Issue

@clerk/nextjs@7 declares the peer dependency next@"^15.2.8 || ^15.3.8 || ^15.4.10 || ^15.5.9 || ^15.6.0-0 || ^16.0.10 || ^16.1.0-0".
@clerk/upgrade never checks the installed next version before upgrading. On a Next 14 app,
npx @clerk/upgrade --sdk=nextjs --release=core-3 runs npm install @clerk/nextjs@7, npm rejects it, and the tool exits with:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error Could not resolve dependency:
npm error peer next@"^15.2.8 || ^15.3.8 || ^15.4.10 || ^15.5.9 || ^15.6.0-0 || ^16.0.10 || ^16.1.0-0" from @clerk/nextjs@7.10.7
✗ Failed to upgrade @clerk/nextjs

Where

packages/upgrade, as published in @clerk/upgrade@2.0.11:

  • versions/core-3/index.js: sdkVersions only records the Clerk SDK's own versions (nextjs: { from: 6, to: 7 }).
    There is no minimum framework version.
  • cli.js, performUpgrade(): runs the package manager's install directly. When it fails, it prints the
    package manager's output and calls process.exit(1).
  • cli.js, the main flow: the package upgrade (step 6) runs before the codemods (step 7), so a failed
    install means no codemods run.

Consequences

  • The upgrade stops with nothing migrated: no codemods run and no breaking-change scan is done.
  • The only explanation is npm's peer-dependency dump. Nothing says "upgrade Next.js to 15.2.8+ or 16 first",
    so users have to work it out from npm's resolver output.

Suggested fix

Before step 6, read the installed framework version and compare it with the new SDK's peer range, e.g.
a peerRequirements: { nextjs: { next: '>=15.2.8' } } entry in versions/core-3. If it doesn't match, stop
before changing anything:

core-3 needs Next.js 15.2.8+ or 16. You have 14.2.16. Upgrade Next.js first, then rerun.


Found with modeval, which runs codemods against real repositories
that depend on a package and checks the results.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions