You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

Expo SDK 53下Hermes与原生依赖兼容问题排查求助

Expo SDK 53下Hermes与原生依赖兼容问题排查求助

各位好!我最近在升级Expo React Native项目的依赖后,遇到了Hermes相关的报错——不管是运行npx expo start --clear还是构建应用都会触发。我已经尝试了不少排查步骤,但问题还是没解决,想请大家帮忙看看!

我目前已经试过的操作:

  • 确认了expo及所有Expo相关包的版本都是匹配的
  • 重新安装了node_modules,并且清理了各类缓存(包括expo start --clearnpm cache clean --force
  • 更新了tsconfig.json,移除了module和moduleResolution相关的冲突配置项
  • 检查了app.json和babel.config.js,确保Hermes的启用状态是一致的(我这边是启用状态)
  • npm list expo检查了项目中有没有不兼容的原生依赖或者重复的expo版本

我的当前tsconfig.json配置如下:

{
  "extends": "expo/tsconfig.base",
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "jsx": "react-native",
    "lib": ["dom", "esnext"],
    "module": "Node16",
    "moduleResolution": "Node16",
    "noEmit": true,
    "skipLibCheck": true,
    "resolveJsonModule": true,
    "strict": true,
    "baseUrl": ".",
    "paths": {
      "*": ["src/*"],
      "@components/*": ["src/components/*"],
      "@container/*": ["src/container/*"],
      "@configs/*": ["src/configs/*"],
      "@navigation/*": ["src/navigation/*"],
      "@images/*": ["src/images/*"],
      "@configs": ["src/configs/index"],
      "@store/*": ["src/store/*"],
      "react-native-redash/lib/module/v1": [
        "./node_modules/react-native-redash/lib/typescript/v1/index.d.ts"
      ]
    },
    "types": ["react-native", "react"]
  },
  "include": ["src", "types"]
}

我的项目环境信息:

  • Expo SDK: 53.0.11
  • React Native: 0.79.3
  • TypeScript: ~5.8.3
  • app.json中已启用Hermes:"jsEngine": "hermes"

关键依赖版本:

  • react-native-charts-wrapper ^0.6.0
  • react-native-calendars ^1.1312.1
  • react-native-reanimated 3.17.4

想请教大家几个问题:

  • 这种配置下,Hermes报错的常见诱因有哪些?
  • react-native-charts-wrapper或者其他原生依赖会不会导致Hermes兼容性问题?
  • 有没有已知的问题或者官方推荐的配置,能让Expo SDK 53搭配这些依赖正常使用Hermes?
  • 针对这个项目,该如何正确配置TypeScript和Hermes来避免报错?

内容来源于stack exchange

火山引擎 最新活动