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

React Native项目报错:未找到react-native-gesture-handler模块求助

解决react-native-gesture-handler模块未找到的问题

报错内容翻译:

ERROR [react-native-gesture-handler] 未找到react-native-gesture-handler模块。请确保你在原生平台上运行应用,并且代码已正确链接(执行cd ios && pod install && cd ..)。

如需安装说明,请参考官方文档
LOG 正在运行"aradismobile",参数为{"rootTag":41}

修复步骤:

  • 重新安装依赖模块
    先卸载再重装,确保依赖完整:

    # npm 版本
    npm uninstall react-native-gesture-handler
    npm install react-native-gesture-handler
    
    # yarn 版本
    yarn remove react-native-gesture-handler
    yarn add react-native-gesture-handler
    
  • 同步iOS Pod依赖
    进入iOS目录执行Pod安装:

    cd ios && pod install && cd ..
    

    如果Pod安装异常,可清理后重试:

    cd ios
    rm -rf Pods Podfile.lock
    pod install
    cd ..
    
  • 清理缓存并重启开发服务
    清除React Native缓存,避免缓存冲突:

    npx react-native start --reset-cache
    

    之后重启模拟器/真机,重新运行项目:

    npx react-native run-ios  # iOS平台
    npx react-native run-android  # Android平台
    
  • 验证Android原生配置
    检查android/settings.gradle是否包含:

    include ':react-native-gesture-handler'
    project(':react-native-gesture-handler').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-gesture-handler/android')
    

    检查android/app/build.gradle的dependencies块是否有:

    implementation project(':react-native-gesture-handler')
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.30 21:03:11