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

升级Expo SDK46后出现TypeError: _ReanimatedModule.configureProps未定义问题求助

解决Expo SDK 46.0.0 + Reanimated 2.9.1 启动报错问题

错误信息

ERROR TypeError: _ReanimatedModule.default.configureProps is not a function. (In '_ReanimatedModule.default.configureProps(Object.keys(NATIVE_THREAD_PROPS_WHITELIST), Object.keys(UI_THREAD_PROPS_WHITELIST))', '_ReanimatedModule.default.configureProps' is undefined)
ERROR Invariant Violation: "main" has not been registered. This can happen if:

  • Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.
  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

解决方案

  • 重新安装Reanimated并确认版本匹配
    先卸载现有包,再重新安装指定版本:

    npm uninstall react-native-reanimated
    npm install react-native-reanimated@2.9.1
    

    若用Yarn则替换为:

    yarn remove react-native-reanimated
    yarn add react-native-reanimated@2.9.1
    
  • 校验Babel配置的正确性
    确保babel.config.js中react-native-reanimated/plugin插件放在所有插件的最后一位,示例配置:

    module.exports = function(api) {
      api.cache(true);
      return {
        presets: ['babel-preset-expo'],
        plugins: [
          // 其他自定义插件写在这里
          'react-native-reanimated/plugin',
        ],
      };
    };
    
  • 彻底清理缓存并重启服务
    执行Expo专属的缓存清理命令,同时重启Metro:

    expo r -c
    

    执行前需关闭所有已运行的Metro终端窗口,确保进程完全终止。

  • 强制统一Reanimated依赖版本
    若存在嵌套依赖导致版本不一致,在package.json中添加resolutions字段强制统一:

    "resolutions": {
      "react-native-reanimated": "2.9.1"
    }
    

    然后重新安装依赖:

    npm install
    
  • 检查AppRegistry注册逻辑
    确认项目入口文件(通常为App.js或index.js)中正确执行了组件注册:

    import { AppRegistry } from 'react-native';
    import App from './App';
    import { name as appName } from './app.json';
    
    AppRegistry.registerComponent(appName, () => App);
    

错误原因说明

第一个错误是Reanimated的原生模块未正确加载,导致核心方法configureProps不存在;第二个错误是由于第一个错误阻断了组件初始化流程,最终导致AppRegistry.registerComponent未执行。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 13:15:21