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

Expo托管工作流集成react-native-fbads时EAS构建报错求助

解决Expo托管工作流中react-native-fbads插件解析失败问题

环境信息

  • react-native-fbads: 7.1.0
  • react-native: 0.68.2
  • 使用Expo托管工作流,执行eas build --profile development --platform ios时触发报错:

    Failed to resolve plugin for module "react-native-fbads" relative to "D:\Projects\pollenbbmap"

提供的app.json配置如下:

{
  "expo": {
    "owner": "gainesvilleboyz",
    "name": "pollenbbmap",
    "slug": "pollenbbmap",
    "version": "0.0.1",
    "orientation": "portrait",
    "icon": "./assets/icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#ffffff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "com.arham23.pollenbbmap"
    },
    "android": {
      "adaptiveIcon": {
        "foregroundImage": "./assets/adaptive-icon.png",
        "backgroundColor": "#FFFFFF"
      }
    },
    "web": {
      "favicon": "./assets/favicon.png"
    },
    "plugins": [
      [
        "react-native-fbsdk-next",
        {
          "appID": "XXXX",
          "clientToken": "XXX",
          "displayName": "Pollen Map App",
          "advertiserIDCollectionEnabled": false,
          "autoLogAppEventsEnabled": false,
          "isAutoInitEnabled": true,
          "iosUserTrackingPermission": "This identifier will be used to deliver personalized ads to you."
        }
      ],
      "react-native-fbads"
    ]
  }
}

排查与解决步骤

  • 换用Expo适配插件:react-native-fbads 7.x版本未提供官方Expo插件,需安装社区适配的@config-plugins/react-native-fbads:

    1. 执行命令安装插件:
      npm install @config-plugins/react-native-fbads --save-dev
      
    2. 修改app.json的plugins配置,将"react-native-fbads"替换为"@config-plugins/react-native-fbads"
  • 重新安装依赖并清理缓存:

    npm install react-native-fbads --save
    npx expo prebuild --clean
    npm start --clear
    
  • 验证版本兼容性:react-native 0.68.2对应Expo SDK 45.x,确认react-native-fbads 7.1.0是否支持该SDK版本。若不兼容,可降级react-native-fbads到适配版本,或同步升级Expo SDK(需保持与react-native版本匹配)。

  • 本地预构建测试:先运行npx expo prebuild --platform ios,查看能否成功生成iOS项目文件。若本地预构建失败,根据终端报错定位具体问题(如依赖缺失、配置错误等)。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.23 01:54:21