错误构建:Framework not found爱马仕on MacOS 13.3/Xcode 14

ebdffaop  于 2023-05-30  发布在  Mac
关注(0)|答案(1)|浏览(249)

bounty还有3天到期。此问题的答案有资格获得+50声望奖励。user938363正在寻找一个答案从一个有信誉的来源

在将macOS从12.x升级到最新的13.x之后,我的React Native 0.70.1的构建开始抛出上面的错误。ruby -v输出:

rbenv: version `2.7.5' is not installed (set by /Users/macair/documents/code/js/myapp/.ruby-version)

然后呢

brew -v
Homebrew 3.6.12
Homebrew/homebrew-core (git revision 1d7a7a30898; last commit 2022-11-22)
Homebrew/homebrew-cask (git revision c0c877a95b; last commit 2022-11-22)

但是,如果移出应用根目录或上面的其他目录,ruby -v输出:

ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin21]

MacOS 13.x预装了ruby 2.6.8,但在Mac上找不到。react-native run-ios和pod install都成功运行。然而,构建失败了。
下面是相关的package.json:

"dependencies": {
    "@ethersproject/shims": "^5.7.0",
    "@react-native-community/toolbar-android": "^0.2.1",
    "@react-native-masked-view/masked-view": "^0.2.7",
    "@react-native-picker/picker": "^2.4.4",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/stack": "^6.3.1",
    "appcenter": "^4.4.5",
    "appcenter-analytics": "^4.4.5",
    "appcenter-crashes": "^4.4.5",
    "crypto-js": "^4.1.1",
    "ethers": "^5.7.1",
    "react": "18.1.0",
    "react-native": "0.70.1",
    "react-native-blob-util": "^0.16.2",
    "react-native-code-push": "^8.0.1",
    "react-native-confirmation-code-field": "^7.3.0",
    "react-native-device-info": "^10.2.0",
    "react-native-easy-grid": "^0.2.2",
    "react-native-elements": "^3.4.2",
    "react-native-encrypted-storage": "^4.0.2",
    "react-native-gesture-handler": "^2.6.1",
    "react-native-get-random-values": "^1.8.0",
    "react-native-gifted-chat": "^1.0.4",
    "react-native-image-picker": "^4.10.0",
    "react-native-loading-spinner-overlay": "^3.0.1",
    "react-native-modal": "^13.0.1",
    "react-native-reanimated": "^3.1.0",
    "react-native-redash": "^18.1.0",
    "react-native-responsive-screen": "^1.4.2",
    "react-native-safe-area-context": "^4.3.4",
    "react-native-screens": "^3.17.0",
    "react-native-vector-icons": "^9.2.0",
    "react-native-video": "^5.2.1",
    "react-native-webview": "^12.0.2",
    "rn-alioss": "^0.2.5",
    "socket.io-client": "^4.5.2"
  },
  "devDependencies": {
    "@babel/core": "^7.19.1",
    "@babel/runtime": "^7.19.0",
    "@react-native-community/eslint-config": "^3.1.0",
    "@testing-library/react-native": "^11.1.0",
    "babel-jest": "^29.0.3",
    "eslint": "^8.23.1",
    "jest": "^29.0.3",
    "metro-react-native-babel-preset": "^0.72.1",
    "react-test-renderer": "18.1.0"
  },

下面是Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '13'  #12.4
install! 'cocoapods', :deterministic_uuids => false

target 'xyz_app6' do
  config = use_native_modules!

  # Flags change depending on the env values.
  flags = get_default_flags()

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    :hermes_enabled => true,
    :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'xyz_app6Tests' do
    inherit! :complete
    # Pods for testing
  end

  #post_install do |installer|
    #installer.pods_project.targets.each do |target|
      #target.build_configurations.each do |config|
      # some older pods don't support some architectures, anything over iOS 11 resolves that
      #  config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '13.0' #'12.0'
      #end
    #end
  #end

  post_install do |installer|
    react_native_post_install(
      installer,
      # Set `mac_catalyst_enabled` to `true` in order to apply patches
      # necessary for Mac Catalyst builds
      :mac_catalyst_enabled => false
    )
    __apply_Xcode_12_5_M1_post_install_workaround(installer)

  end
end
mec1mxoz

mec1mxoz1#

您看到的错误消息表明未安装为项目指定的Ruby版本(2.7.5)。您可以使用rbenv来管理Ruby版本并设置项目所需的版本。
有一个great article by DigitalOcean关于如何使用rbenv安装特定的ruby版本。

相关问题