2023-02-10 Requiring module "node_modules\react-native-reanimated\src\index.ts",(未解决)
完整报错:
Error: Requiring module "node_modules\react-native-reanimated\src\index.ts", which threw an exception: TypeError: ReanimatedModule.installTurboModule is not a function. (In 'ReanimatedModule.installTurboModule()', 'ReanimatedModule.installTurboModule' is undefined)
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). A frequent cause of the error is that the application entry file path is incorrect.
This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
ok,我只关注了第一句话:Requiring module "node_modules\react-native-reanimated\src\index.ts"(需要模块“node_modules\react native reanimated\src\index.ts”)
报错回溯:我的目的是使用插件react-native-tab-view来制作一个tab选项卡,把react-native-tab-view、react-native-reanimated和react-native-gesture-handler都装了后,按照官网代码进行使用报错。
我做了一下操作:
删除node_module,在android(注意我只在安卓机测试)里找到gradle.properties并在里面添加:
newArchEnabled=true
在babel.config.js里面添加react-native-reanimated/plugin
module.exports = { presets: ['module:metro-react-native-babel-preset'], plugins: ["react-native-reanimated/plugin"], };
把react-native-reanimated版本(2.14.2)修改为2.4.0
找到android/app/build.gradle,把project.ext.react的enableHermes的false改成true,
project.ext.react = [ enableHermes: true, // clean and rebuild if changing ]
在项目入口文件index.js的第一行写上
import 'react-native-gesture-handler';
然并卵,已经放弃了react-native-tab-view的使用。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧