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

React Native iOS项目无法运行问题求助

React Native iOS端构建运行异常排查

Invariant Violation Error

  • 搭建了同时支持Android和iOS的React Native项目,目前仅Android端可成功构建并运行。
  • 所有操作均在macOS环境下完成,无法排查出iOS端配置缺失的内容。
  • 已严格按照React Native官方文档完成iOS项目的配置步骤,附上错误截图及package.json文件内容供排查参考。

package.json 内容

{
  "name": "MyProject",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android": "npx react-native run-android --variant=devDebug --appIdSuffix=dev",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest",
    "android:qa": "npx react-native run-android --variant=qaDebug --appIdSuffix=qa",
    "android:sit": "npx react-native run-android --variant=sitDebug --appIdSuffix=sit",
    "android:prod": "npx react-native run-android --variant=prodDebug --appIdSuffix=prod",
    "android:uat": "npx react-native run-android --variant=uatDebug --appIdSuffix=uat",
    "ios:uat": "npx react-native run-ios --scheme 'uatDebug'"
  },
  "sdkDependencies": {
    "SalesforceMobileSDK-Android": "https://github.com/forcedotcom/SalesforceMobileSDK-Android.git#v11.1.0",
    "SalesforceMobileSDK-iOS": "https://github.com/forcedotcom/SalesforceMobileSDK-iOS.git#v10.0.0"
  },
  "dependencies": {
    "@gorhom/bottom-sheet": "^4",
    "@react-native-async-storage/async-storage": "^1.19.1",
    "@react-native-community/datetimepicker": "^7.6.1",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/netinfo": "11.1.0",
    "@react-native-masked-view/masked-view": "^0.3.0",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@reduxjs/toolkit": "^1.9.5",
    "@rneui/base": "^4.0.0-rc.7",
    "@rneui/themed": "^4.0.0-rc.7",
    "axios": "^1.4.0",
    "fuse.js": "3.2.0",
    "geolib": "^3.3.4",
    "moment": "^2.29.4",
    "react": "18.1.0",
    "react-native": "0.70.14",
    "react-native-actions-sheet": "0.8.29",
    "react-native-calendars": "^1.1301.0",
    "react-native-config": "^1.5.1",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-device-info": "^10.12.0",
    "react-native-element-dropdown": "^2.9.0",
    "react-native-elements": "^3.4.3",
    "react-native-fast-image": "^8.6.3",
    "react-native-force": "git+https://github.com/forcedotcom/SalesforceMobileSDK-ReactNative.git#v11.1.0",
    "react-native-fs": "^2.20.0",
    "react-native-geolocation-service": "^5.3.1",
    "react-native-gesture-handler": "^2.12.1",
    "react-native-image-picker": "^5.6.0",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-maps": "^1.9.0",
    "react-native-marquee-view": "^1.0.5",
    "react-native-permissions": "^3.8.4",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-reanimated": "2.11.0",
    "react-native-safe-area-context": "^4.7.0",
    "react-native-screens": "3.29.0",
    "react-native-shimmer-placeholder": "^2.0.9",
    "react-native-skeleton-placeholder": "^5.2.4",
    "react-native-svg": "^13.10.0",
    "react-native-swiper": "^1.6.0",
    "react-native-vector-icons": "^10.0.0",
    "react-native-video": "^5.2.1",
    "react-native-view-shot": "^3.8.0",
    "react-native-webview": "^13.6.2",
    "react-native-youtube-iframe": "^2.3.0",
    "react-redux": "^8.1.1",
    "redux-persist": "^6.0.0",
    "sp-react-native-in-app-updates": "^1.3.1",
    "victory-native": "^36.6.11"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/eslint-config": "^0.72.2",
    "@react-native/metro-config": "^0.72.7",
    "@tsconfig/react-native": "^3.0.0",
    "@types/metro-config": "^0.76.3",
    "@types/react": "^18.0.24",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.2.1",
    "babel-plugin-module-resolver": "^5.0.0",
    "eslint": "^8.19.0",
    "jest": "^29.2.1",
    "metro-react-native-babel-preset": "0.76.5",
    "prettier": "^2.4.1",
    "react-devtools": "^4.28.0",
    "react-native-flipper": "^0.207.0",
    "react-native-svg-transformer": "^1.0.0",
    "react-test-renderer": "18.1.0",
    "redux-flipper": "^2.0.2",
    "typescript": "^5.3.3"
  },
  "engines": {
    "node": ">=16"
  }
}

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.26 20:17:02