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

React Native iOS构建报错:PhaseScriptExecution 'FBReactNativeSpec' 错误码65

iOS构建失败:FBReactNativeSpec目标报错(xcodebuild返回码65)

最近升级部分依赖包后,iOS构建触发如下错误:

(in target 'FBReactNativeSpec' from project 'Pods') (1 failure)
##[error]Error: /usr/bin/xcodebuild failed with return code: 65

项目的package.json依赖配置如下:

"dependencies": {
    "@eva-design/eva": "^2.1.1",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/analytics": "^12.7.4",
    "@react-native-firebase/app": "^12.7.4",
    "@react-native-firebase/crashlytics": "^12.7.4",
    "@react-navigation/native": "^6.1.4",
    "@react-navigation/stack": "^6.3.14",
    "@ui-kitten/components": "^5.1.2",
    "@ui-kitten/eva-icons": "^5.1.2",
    "date-fns": "^2.29.3",
    "lodash": "^4.17.21",
    "query-string": "^7.0.1",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-native": "0.65.1",
    "react-native-app-auth": "^6.4.3",
    "react-native-device-info": "^8.3.1",
    "react-native-dotenv": "^3.2.0",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-loading-spinner-overlay": "^2.0.0",
    "react-native-offline": "^6.0.2",
    "react-native-safe-area-context": "^3.3.1",
    "react-native-screens": "^3.6.0",
    "react-native-splash-screen": "^3.3.0",
    "react-native-status-bar-height": "^2.6.0",
    "react-native-svg": "^13.8.0",
    "react-native-svg-transformer": "^1.0.0",
    "react-redux": "^8.0.5",
    "redux": "^4.2.1",
    "redux-logger": "^3.0.6",
    "redux-pack": "^0.1.5",
    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.4.2",
    "reselect": "^4.1.7",
    "rn-fetch-blob": "^0.12.0",
    "victory-native": "^36.6.8"
  },
  "devDependencies": {
    "@babel/core": "^7.20.12",
    "@babel/runtime": "^7.15.3",
    "@react-native-community/eslint-config": "^3.2.0",
    "@testing-library/jest-native": "^5.4.1",
    "@testing-library/react-native": "^11.5.2",
    "babel-jest": "^29.4.3",
    "eslint": "^8.34.0",
    "eslint-plugin-react": "^7.26.0",
    "jest": "^29.4.3",
    "metro-react-native-babel-preset": "^0.75.0",
    "react-native-codegen": "^0.71.5",
    "react-test-renderer": "^18.2.0"
  },

已尝试以下方案但未解决:

  • 用arch -x86_64 pod install替代pod install
  • 执行pod deintegrate && pod cache clean --all && pod install
  • 执行rm -rf node_modules && yarn && cd ios && pod install

之前通过npm run ios可正常运行项目。


解决方案

  1. 匹配react-native-codegen版本
    核心问题是react-native@0.65.1与react-native-codegen@0.71.5版本不兼容,后者版本过高。修改package.json中react-native-codegen的版本为与RN主版本匹配的0.65.x系列,例如:

    "react-native-codegen": "^0.65.20"
    

    然后执行以下命令重置依赖:

    rm -rf node_modules package-lock.json yarn.lock
    yarn install # 或 npm install
    cd ios
    pod deintegrate
    pod install
    
  2. 清理Xcode缓存
    打开Xcode后执行:

    • 菜单栏选择Product > Clean Build Folder
    • 删除~/Library/Developer/Xcode/DerivedData目录下的项目缓存
      之后重新构建项目。
  3. 排查Native依赖兼容性
    检查此次升级的Native模块(如react-native-device-info、react-native-svg等),确认其版本是否适配react-native@0.65.1,若存在不兼容情况,回退到对应适配版本。

  4. 校验Metro配置
    若升级依赖时修改过metro.config.js,需确保配置内容适配react-native@0.65.1,避免引入高版本codegen相关的配置项。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.30 21:21:49