react-native run-ios 构建失败,错误很多

时间:2021-06-19 21:57:30

标签: xcode react-native react-native-ios

我只在 android 环境中构建了 React Native 应用程序,一切都很好。后来我决定在 iOS 中运行它,我遵循了在 iOS 环境中运行所需的官方文档,然后我在 iOS 文件夹中运行 pod install 并为一些包做一些链接,但最终构建失败有很多警告和错误。 我无法弄清楚到底是什么问题。 每次我run react-native run-ios时,我都会遇到与上一次不同的错误。

我也尝试使用这些命令清除 pod 缓存

rm -rf ~/Library/Caches/CocoaPods
rm -rf Pods
rm -rf ~/Library/Developer/Xcode/DerivedData/*
pod deintegrate
pod setup
pod install

并且还删除了 node_modules 文件夹并重新安装。但没有任何效果。 现在我收到此错误:

<块引用>

以下构建命令失败: Ld /Users/mzc/Library/Developer/Xcode/DerivedData/qlessNew-fkilqkvhfxtgydazlsprlgsyfnfn/Build/Products/Debug-iphonesimulator/qlessNew.app/appNew 正常(1次失败)

但是,当我在 xcode 中构建应用程序时,出现了以下错误: errors

这是环境信息:

 System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i5-1038NG7 CPU @ 2.00GHz
    Memory: 48.61 MB / 16.00 GB
    Shell: 5.1.4 - /usr/local/bin/bash
  Binaries:
    Node: 15.14.0 - /usr/local/bin/node
    Yarn: 1.22.10 - /usr/local/bin/yarn
    npm: 7.10.0 - /usr/local/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.10.1 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
    Android SDK: Not Found
  IDEs:
    Android Studio: 4.1 AI-201.8743.12.41.7199119
    Xcode: 12.5/12E262 - /usr/bin/xcodebuild
  Languages:
    Java: 16.0.1 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.13.1 => 16.13.1 
    react-native: 0.63.4 => 0.63.4 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

这是 package.json 文件:

{
  "name": "qlessNew",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@ant-design/react-native": "^4.0.7",
    "@freakycoder/react-native-bounceable": "^0.1.1",
    "@freakycoder/react-native-helpers": "^1.0.1",
    "@react-native-community/async-storage": "^1.12.1",
    "@react-native-community/blur": "^3.6.0",
    "@react-native-community/cameraroll": "^4.0.2",
    "@react-native-community/checkbox": "^0.5.7",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-community/segmented-control": "^2.2.2",
    "@react-native-community/slider": "^3.0.3",
    "@react-native-community/viewpager": "^3.3.0",
    "@react-native-firebase/app": "^12.1.0",
    "@react-native-firebase/auth": "^12.1.0",
    "@react-native-firebase/firestore": "^12.1.0",
    "@react-native-firebase/storage": "^12.1.0",
    "@react-native-google-signin/google-signin": "^6.0.0",
    "@react-native-picker/picker": "^1.9.12",
    "@react-navigation/bottom-tabs": "^5.11.2",
    "@react-navigation/drawer": "^5.11.4",
    "@react-navigation/material-top-tabs": "^5.3.14",
    "@react-navigation/native": "^5.9.3",
    "@react-navigation/stack": "^5.12.8",
    "@reduxjs/toolkit": "^1.5.1",
    "axios": "^0.21.1",
    "firebase-tools": "^9.13.1",
    "install": "^0.13.0",
    "lodash": "^4.17.21",
    "lottie-ios": "3.1.8",
    "lottie-react-native": "^4.0.2",
    "native-base": "^2.15.2",
    "react": "16.13.1",
    "react-native": "0.63.4",
    "react-native-action-button": "^2.8.5",
    "react-native-androw": "^0.0.34",
    "react-native-animatable": "^1.3.3",
    "react-native-apple-card-views": "^2.1.2",
    "react-native-awesome-card-io": "^0.9.0",
    "react-native-camera": "^3.43.6",
    "react-native-checkbox-card": "^0.1.0",
    "react-native-counter-input": "^0.1.9",
    "react-native-credit-card-input": "^0.4.1",
    "react-native-elements": "^3.3.1",
    "react-native-gesture-handler": "^1.10.3",
    "react-native-gradient-header": "^0.2.1",
    "react-native-image-header-scroll-view": "^0.10.3",
    "react-native-image-helper": "^0.0.3",
    "react-native-image-slider-box": "^1.0.12",
    "react-native-iphone-x-helper": "^1.3.1",
    "react-native-keyboard-aware-scroll-view": "^0.9.3",
    "react-native-keyboard-spacer": "^0.4.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-modal": "^11.7.0",
    "react-native-multi-grid-selection": "^0.1.6",
    "react-native-onboarding-swiper": "^1.1.4",
    "react-native-pager-view": "^5.1.2",
    "react-native-paper": "^4.7.2",
    "react-native-payments": "^0.8.3",
    "react-native-permission-service": "^0.1.0",
    "react-native-permissions": "^3.0.2",
    "react-native-qrcode-scanner": "^1.5.4",
    "react-native-qrcode-scanner-view": "^2.0.0",
    "react-native-reanimated": "^1.13.2",
    "react-native-redash": "^16.0.8",
    "react-native-safe-area-context": "^3.2.0",
    "react-native-screens": "^2.18.1",
    "react-native-share": "^5.1.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "^12.1.0",
    "react-native-swipe-list-view": "^3.2.5",
    "react-native-swipe-modal-up-down": "^1.0.9",
    "react-native-swiper": "^1.6.0",
    "react-native-tab-view": "^2.16.0",
    "react-native-tabview": "^1.0.0",
    "react-native-tear-lines": "^1.0.5",
    "react-native-toast-message": "^1.4.9",
    "react-native-vector-icons": "^7.1.0",
    "react-navigation-drawer": "^2.7.0",
    "react-navigation-stack": "^2.10.2",
    "react-redux": "^7.2.3",
    "reanimated-bottom-sheet": "^1.0.0-alpha.22",
    "redux": "^4.0.5",
    "styled-components": "^5.2.1",
    "tipsi-stripe": "^9.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.4",
    "@babel/runtime": "^7.8.4",
    "@react-native-community/eslint-config": "^1.1.0",
    "babel-jest": "^25.1.0",
    "eslint": "^6.5.1",
    "jest": "^25.1.0",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.13.1"
  },
  "jest": {
    "preset": "react-native"
  }
}

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, '14.3'

target 'qlessNew' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  pod 'Braintree', :inhibit_warnings => true
# Add the pod for Firebase Crashlytics
pod 'Firebase/Crashlytics'

# Recommended: Add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
  # Install additional dependencies

pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe'

  target 'qlessNewTests' do
    inherit! :complete
    # Pods for testing
  end
  
  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
  # you should disable these next few lines.
  #use_flipper!({ 'Flipper-Folly' => '2.3.0' })
  #post_install do |installer|
   # flipper_post_install(installer)
  #end
end
post_install do |installer|
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
         if config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'].to_f < 14.3
           config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '14.3'
         end
      end
  end
end
target 'qlessNew-tvOS' do
  # Pods for qlessNew-tvOS

  target 'qlessNew-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

0 个答案:

没有答案