fix: 降级 ink/react 使 Node >=18 兼容声明真实成立 - #10
Merged
Merged
Conversation
ink ^6.8.0 声明 engines node >=20,与 package.json 的 >=18 冲突, Node 18 用户实际无法运行。降级到 ink 5.2.1(engines >=18)。 同时降级 react 19 → 18.3.1:ink 5 的 reconciler 依赖 React 18 内部 API,搭配 react 19 实测启动即崩(TypeError: Cannot read properties of undefined (reading 'ReactCurrentOwner')), @types/react 同步降至 ^18。 实测:pty 中 TUI 完整渲染(列表/分页/快捷键栏)无任何错误; tsc --noEmit、npm run build、npm audit --audit-level=high 全部通过。 版本 1.7.0 → 1.7.1(fix → patch)。 Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
package.json声明engines.node: ">=18",但运行时依赖 ink ^6.8.0 要求node >=20——Node 18 用户安装时 npm 仅警告,实际运行会失败,声明形同虚设。改动
ink>=20;ink 5.2.1 为>=18react@types/react为什么 react 必须一起降
ink 5.2.1 的 peerDependencies 写的是
react >=18.0.0,但只单独降 ink 时实测启动即崩:react 19 移除了 ink 5 所依赖的
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED内部结构,>=18.0.0这个 peer 范围写得过宽。代码仅使用import React等稳定 API,18/19 无差异,降级零代码改动。验证
npx tsc --noEmit通过npm run build通过▲/▼ N more分页提示、底部快捷键栏均正常,无任何错误(单独降 ink 时崩溃,ink 5 + react 18 组合 0 错误)npm audit --audit-level=high通过(仅 1 low)🤖 Generated with Claude Code