You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行ReactFlow v11版本时遭遇react/jsx-runtime错误求助

ReactFlow v11 运行时"react/jsx-runtime"脚本错误解决方案

运行ReactFlow v11时出现如下错误:
failedModules=sg-lineage-ui/js/sg-lineage-ui:Script error for "react/jsx-runtime"

已尝试在package.json中添加以下最新版本依赖,但问题仍未解决:

// ... rest
"dependencies": {
  "react": "^18.0.0",
  "react-dom": "^18.0.0",
},
"devDependencies": {
  "@types/react": "^18.0.5",
  "@types/react-dom": "^18.0.1",
}
}

试试这些解决办法:

  • 直接安装react/jsx-runtime:React 17+默认集成该模块,但依赖树异常可能导致缺失,执行命令:

    npm install react/jsx-runtime
    # 用yarn的话:yarn add react/jsx-runtime
    
  • 清除缓存重装依赖:

    npm cache clean --force
    rm -rf node_modules package-lock.json
    npm install
    
  • 检查构建工具配置:如果用自定义webpack配置,确认resolve.alias没有错误映射react/jsx-runtime,确保配置能正确识别React内置模块。

  • 锁定ReactFlow兼容版本:ReactFlow v11要求React 17+,可以尝试安装指定稳定版本:

    npm install reactflow@11.10.4
    
  • 更新sg-lineage-ui:这个依赖包可能对React或jsx-runtime有特定版本要求,更新到最新版本再试。

内容的提问来源于stack exchange,提问作者Honey Thakuria

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.12 17:35:19