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

未关闭
#10,967 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@wobsoriano 已经在做这个了。

开始于 2026年11月24日。

  • #10995 来自 @wobsoriano —— 未关闭

评估

难度
3/5
预计耗时
1-2 天
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
领域
cli, tooling

调研方向

Start by reading packages/upgrade/versions/core-3/index.js to see how sdkVersions is declared, then trace performUpgrade() and the main flow in packages/upgrade/cli.js, especially where the package-manager install runs before codemods. Add a pre-install check that reads the installed next version, compares it with the new SDK's peer range, and stops with the suggested message before any install or migration. Verify with a Next 14 fixture that the tool exits early without running npm or codemods, and with Next 15 that the upgrade proceeds.

由索引模型根据 Issue 内容生成。

描述

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/[email protected]
✗ Failed to upgrade @clerk/nextjs
Where

packages/upgrade, as published in @clerk/[email protected]:

  • 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.

主要语言
TypeScript
星标
1.8k
派生
493
平均合并
1 天 8 小时
30 天内合并 PR
359

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

clerk/javascript 的其他 Issue

查看 clerk/javascript 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。