react-native icon indicating copy to clipboard operation
react-native copied to clipboard

pod install error on M1 Macbook

Open Haiananan opened this issue 1 year ago • 13 comments

Description

I followed the instructions of https://reactnative.cn/docs/environment-setup but i always occur an error when i run pod install

Looking for related issues on cocoapods/cocoapods...
Searching for inspections failed: undefined method `map' for nil:NilClass

[!] Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).

[!]  - Emulated x86_64 is slower than native arm64

[!]  - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)

[!] Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.

Version

0.71

Output of npx react-native info

System: OS: macOS 13.1 CPU: (8) arm64 Apple M1 Memory: 359.53 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 19.4.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 8.19.3 - /usr/local/bin/npm Watchman: 2023.01.23.00 - /usr/local/bin/watchman Managers: CocoaPods: 1.11.3 - /Users/hai/.rvm/gems/ruby-2.7.6/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: API Levels: 24, 25, 28, 29, 30, 31, 32, 33 Build Tools: 27.0.3, 28.0.3, 29.0.2, 30.0.2, 30.0.3, 31.0.0 System Images: android-30 | Google APIs Intel x86 Atom, android-31 | Google Play ARM 64 v8a Android NDK: Not Found IDEs: Android Studio: 2020.3 AI-203.7717.56.2031.7784292 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 1.8.0_291 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: Not Found react-native: Not Found react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Steps to reproduce

brew install cocoapods

sudo arch -x86_64 gem install ffi arch -x86_64 pod install

or

pod install

always occur this

Snack, code example, screenshot, or link to a repository

Stack

   CocoaPods : 1.11.3
        Ruby : ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin22]
    RubyGems : 3.1.6
        Host : macOS 13.1 (22C65)
       Xcode : 14.2 (14C18)
         Git : git version 2.37.1 (Apple Git-137.1)
Ruby lib dir : /Users/hai/.rvm/rubies/ruby-2.7.6/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.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, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'hello2' 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 => flags[:hermes_enabled],
    :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 => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

  target 'hello2Tests' do
    inherit! :complete
    # Pods for testing
  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

Error

JSON::ParserError - unexpected token at '{
  "name": "Flipper",
  "version": "0.125.0",
  "license": {
    "type": "MIT"
  },
  "homepage": "https://github.com/facebook/flipper",
  "summary": "SonarKit core cpp code with network implementation",
  "authors": "Facebook",
  "source": {
    "git": "https://github.com/facebook/flipper.git",
    "tag": "v0.125.0"
  },
  "module_name": "Flipper",
  "public_header_files": [
    "xplat/Flipper/*.h",
    "xplat/utils/*.h"
  ],
  "source_files": [
    "xplat/Flipper/*.{h,cpp,m,mm}",
    "xplat/Flipper/utils/*.{h,cpp,m,mm}"
  ],
  "libraries": "stdc++",
  "dependencies": {
    "Flipper-Folly": [
      "~> 2.6\n  "
    ],
    "Flipper-RSocket": [
      "~> 1.4"
    ]
  },
  "compiler_flags": "-DFLIPPER_OSS=1 -DFB_SONARKIT_ENABLED=1 -DFOLLY_HAVE_BACKTRACE=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_HAVE_LIBGFLAGS=0 -DFOLLY_HAVE_LIBJEMALLOC=0 -DFOLLY_HAVE_PREADV=0 -DFOLLY_HAVE_PWRITEV=0 -DFOLLY_HAVE_TFO=0 -DFOLLY_USE_SYMBOLIZER=0 -Wall\n    -std=c++14\n    -Wno-global-constructors",
  "platforms": {
    "ios": "10.0"
  },
  "pod_target_xcconfig": {
    "USE_HEADERMAP": "NO",
    "CLANG_CXX_LANGUAGE_STANDARD": "c++14",
    "HEADER_SEARCH_PATHS": "\"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/Flipper-Boost-iOSX\" \"$(PODS_ROOT)/Flipper-RSocket\" \"$(PODS_ROOT)/Flipper-DoubleConversion\" \"$(PODS_ROOT)/libevent/incl'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/json-2.6.3/lib/json/common.rb:216:in `parse'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/json-2.6.3/lib/json/common.rb:216:in `parse'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification/json.rb:61:in `from_json'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:748:in `from_string'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/specification.rb:722:in `from_file'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/source.rb:188:in `specification'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver/lazy_specification.rb:37:in `specification'
/Users/hai/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/delegate.rb:342:in `block in delegating_block'
/Users/hai/.rvm/rubies/ruby-2.7.6/lib/ruby/2.7.0/delegate.rb:343:in `block in delegating_block'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:178:in `dependencies_for'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:18:in `block in dependencies_for'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:17:in `dependencies_for'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:809:in `block in group_possibilities'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in `reverse_each'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:808:in `group_possibilities'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:779:in `possibilities_for_requirement'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:761:in `push_state_for_requirements'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:744:in `require_nested_dependencies_for'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:727:in `activate_new_spec'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:684:in `attempt_to_activate'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:254:in `process_topmost_state'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:182:in `resolve'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:124:in `analyze'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:416:in `analyze'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface.rb:64:in `section'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:240:in `resolve_dependencies'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/installer.rb:161:in `install!'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command/install.rb:52:in `run'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
/Users/hai/Desktop/hello2/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
/Users/hai/.rvm/gems/ruby-2.7.6/bin/pod:23:in `load'
/Users/hai/.rvm/gems/ruby-2.7.6/bin/pod:23:in `<main>'
/Users/hai/.rvm/gems/ruby-2.7.6/bin/ruby_executable_hooks:22:in `eval'
/Users/hai/.rvm/gems/ruby-2.7.6/bin/ruby_executable_hooks:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=unexpected+token+at+%27%7B%0A++%22name%22%3A+%22Flipper%22%2C%0A++%22version%22%3A+%220.125.0%22%2C%0A++%22license%22%3A+%7B%0A++++%22type%22%3A+%22MIT%22%0A++%7D%2C%0A++%22homepage%22%3A+%22https%3A%2F%2Fgithub.com%2Ffacebook%2Fflipper%22%2C%0A++%22summary%22%3A+%22SonarKit+core+cpp+code+with+network+implementation%22%2C%0A++%22authors%22%3A+%22Facebook%22%2C%0A++%22source%22%3A+%7B%0A++++%22git%22%3A+%22https%3A%2F%2Fgithub.com%2Ffacebook%2Fflipper.git%22%2C%0A++++%22tag%22%3A+%22v0.125.0%22%0A++%7D%2C%0A++%22module_name%22%3A+%22Flipper%22%2C%0A++%22public_header_files%22%3A+%5B%0A++++%22xplat%2FFlipper%2F%2A.h%22%2C%0A++++%22xplat%2Futils%2F%2A.h%22%0A++%5D%2C%0A++%22source_files%22%3A+%5B%0A++++%22xplat%2FFlipper%2F%2A.%7Bh%2Ccpp%2Cm%2Cmm%7D%22%2C%0A++++%22xplat%2FFlipper%2Futils%2F%2A.%7Bh%2Ccpp%2Cm%2Cmm%7D%22%0A++%5D%2C%0A++%22libraries%22%3A+%22stdc%2B%2B%22%2C%0A++%22dependencies%22%3A+%7B%0A++++%22Flipper-Folly%22%3A+%5B%0A++++++%22~%3E+2.6%5Cn++%22%0A++++%5D%2C%0A++++%22Flipper-RSocket%22%3A+%5B%0A++++++%22~%3E+1.4%22%0A++++%5D%0A++%7D%2C%0A++%22compiler_flags%22%3A+%22-DFLIPPER_OSS%3D1+-DFB_SONARKIT_ENABLED%3D1+-DFOLLY_HAVE_BACKTRACE%3D1+-DFOLLY_HAVE_CLOCK_GETTIME%3D1+-DFOLLY_NO_CONFIG+-DFOLLY_MOBILE%3D1+-DFOLLY_USE_LIBCPP%3D1+-DFOLLY_HAVE_LIBGFLAGS%3D0+-DFOLLY_HAVE_LIBJEMALLOC%3D0+-DFOLLY_HAVE_PREADV%3D0+-DFOLLY_HAVE_PWRITEV%3D0+-DFOLLY_HAVE_TFO%3D0+-DFOLLY_USE_SYMBOLIZER%3D0+-Wall%5Cn++++-std%3Dc%2B%2B14%5Cn++++-Wno-global-constructors%22%2C%0A++%22platforms%22%3A+%7B%0A++++%22ios%22%3A+%2210.0%22%0A++%7D%2C%0A++%22pod_target_xcconfig%22%3A+%7B%0A++++%22USE_HEADERMAP%22%3A+%22NO%22%2C%0A++++%22CLANG_CXX_LANGUAGE_STANDARD%22%3A+%22c%2B%2B14%22%2C%0A++++%22HEADER_SEARCH_PATHS%22%3A+%22%5C%22%24%28PODS_TARGET_SRCROOT%29%5C%22+%5C%22%24%28PODS_ROOT%29%2FFlipper-Boost-iOSX%5C%22+%5C%22%24%28PODS_ROOT%29%2FFlipper-RSocket%5C%22+%5C%22%24%28PODS_ROOT%29%2FFlipper-DoubleConversion%5C%22+%5C%22%24%28PODS_ROOT%29%2Flibevent%2Fincl%27&type=Issues

If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods... Searching for inspections failed: undefined method `map' for nil:NilClass

[!] Do not use "pod install" from inside Rosetta2 (x86_64 emulation on arm64).

[!] - Emulated x86_64 is slower than native arm64

[!] - May result in mixed architectures in rubygems (eg: ffi_c.bundle files may be x86_64 with an arm64 interpreter)

[!] Run "env /usr/bin/arch -arm64 /bin/bash --login" then try again.

Haiananan avatar Jan 25 '23 13:01 Haiananan

https://github.com/facebook/react-native/issues/33017 This issue's solutions are not work on my macbook, i tried many times

Haiananan avatar Jan 25 '23 13:01 Haiananan

Hi @Haiananan, instead of running pod install could you run bundle install (you need to run this only once) and then bundle exec pod install and let us know if this works?

cipolleschi avatar Jan 31 '23 10:01 cipolleschi

How can I add pod 'AFNetworking' in this podFile? While I added this. It pod failed.

popking5466 avatar Mar 14 '23 08:03 popking5466

Why do you need AFNetworking, in the first place? That's a networking library for native iOS development. Theoretically, you should use JavaScript to perform networking operations with React Native.

cipolleschi avatar Mar 14 '23 19:03 cipolleschi

I'm just giving you example. I want to add some private methods to pod on iOS. Do you have any ideas? 0.60.3 is fine, but 0.71.3 is not

Why do you need AFNetworking, in the first place? That's a networking library for native iOS development. Theoretically, you should use JavaScript to perform networking operations with React Native.

popking5466 avatar Mar 15 '23 00:03 popking5466

Oh, ok. I manage to do it:

  1. Open the ios/Podfile
  2. Modify it like this:
  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    :hermes_enabled => flags[:hermes_enabled],
    :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 => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
+  pod 'AFNetworking', '~> 4.0'
  1. run bundle exec pod install
  2. build the app. Screenshot 2023-03-16 at 12 10 54

The important bit is that the pod '<podname>' statements must be after the use_react_native! function call as we are modifying some build flag and search paths to make sure everything works properly.

cipolleschi avatar Mar 16 '23 12:03 cipolleschi

3. bundle exec pod install

piccolo@Piccolos-MacBook-Pro ios % bundle exec pod install warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir". You can learn more about it here: https://github.com/react-native-community/cli/blob/master/docs/configuration.md Auto-linking React Native modules for target AwesomeTSProject1: RNScreens, react-native-nordic-dfu, and react-native-safe-area-context Framework build type is static library [Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json Analyzing dependencies [Codegen] Found FBReactNativeSpec

――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Command

/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/bin/pod install

Report

  • What did you do?

  • What did you expect to happen?

  • What happened instead?

Stack

   CocoaPods : 1.12.0
        Ruby : ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [arm64-darwin22]
    RubyGems : 3.4.8
        Host : macOS 13.2.1 (22D68)
       Xcode : 14.2 (14C18)
         Git : git version 2.37.1 (Apple Git-137.1)
Ruby lib dir : /Users/piccolo/.rvm/rubies/ruby-2.7.6/lib
Repositories : trunk - CDN - https://cdn.cocoapods.org/
               tsinghua-git-cocoapods - git - https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git @ df8b24482fa59993de7c32511f2aebde33eea25c

Plugins

cocoapods-deintegrate : 1.0.5
cocoapods-plugins     : 1.0.0
cocoapods-search      : 1.0.1
cocoapods-trunk       : 1.6.0
cocoapods-try         : 1.2.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, min_ios_version_supported
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'AwesomeTSProject1' 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 => flags[:hermes_enabled],
     :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 => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )
  pod 'AFNetworking', '~> 4.0'
  target 'AwesomeTSProject1Tests' do
    inherit! :complete
    # Pods for testing
  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

Error

LoadError - dlopen(/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file (/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle), but incompatible platform (have 'iOS', need 'macOS')), '/System/Volumes/Preboot/Cryptexes/OS/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (no such file), '/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file (/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle), but incompatible platform (have 'iOS', need 'macOS')) - /Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi_c.bundle
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi.rb:5:in `rescue in <top (required)>'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ffi-1.15.5/lib/ffi.rb:2:in `<top (required)>'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/ethon-0.16.0/lib/ethon.rb:3:in `<top (required)>'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/.rvm/rubies/ruby-2.7.6/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:37:in `require'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:284:in `ensure_versions_file_loaded'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:208:in `search'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/source/aggregate.rb:83:in `block in search'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/source/aggregate.rb:83:in `select'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/source/aggregate.rb:83:in `search'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:416:in `create_set_from_sources'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:385:in `find_cached_set'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:165:in `search_for'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:267:in `each'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:267:in `sort_by'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:267:in `sort_by!'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:288:in `push_initial_state'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:210:in `start_resolution'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:168:in `resolve'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/resolver.rb:94:in `resolve'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:1082:in `block in resolve_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:1080:in `resolve_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:125:in `analyze'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:422:in `analyze'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:244:in `block in resolve_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:243:in `resolve_dependencies'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:162:in `install!'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/command/install.rb:52:in `run'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:52:in `run'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/gems/cocoapods-1.12.0/bin/pod:55:in `<top (required)>'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/bin/pod:23:in `load'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/bin/pod:23:in `<main>'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/bin/ruby_executable_hooks:22:in `eval'
/Users/piccolo/Files/Piccolo/SelfApp/RN/AwesomeTSProject1/vendor/bundle/ruby/2.7.0/bin/ruby_executable_hooks:22:in `<main>'

――― TEMPLATE END ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

[!] Oh no, an error occurred.

Search for existing GitHub issues similar to yours: https://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%2C+0x0009%29%3A+tried%3A+%27%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%27+%28mach-o+file+%28%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%29%2C+but+incompatible+platform+%28have+%27iOS%27%2C+need+%27macOS%27%29%29%2C+%27%2FSystem%2FVolumes%2FPreboot%2FCryptexes%2FOS%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%27+%28no+such+file%29%2C+%27%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%27+%28mach-o+file+%28%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle%29%2C+but+incompatible+platform+%28have+%27iOS%27%2C+need+%27macOS%27%29%29+-+%2FUsers%2Fpiccolo%2FFiles%2FPiccolo%2FSelfApp%2FRN%2FAwesomeTSProject1%2Fvendor%2Fbundle%2Fruby%2F2.7.0%2Fgems%2Fffi-1.15.5%2Flib%2Fffi_c.bundle&type=Issues

If none exists, create a ticket, with the template displayed above, on: https://github.com/CocoaPods/CocoaPods/issues/new

Be sure to first read the contributing guide for details on how to properly submit a ticket: https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md

Don't forget to anonymize any private data!

Looking for related issues on cocoapods/cocoapods... Searching for inspections failed: undefined method `map' for nil:NilClass piccolo@Piccolos-MacBook-Pro ios %

Hi :), Didn't work for me. What's the problem? :(

popking5466 avatar Mar 17 '23 00:03 popking5466

The error is something like: undefined method 'map' for nil:NilClass from the last line of the log.

Which is weird.

Which version of Ruby and Cocoapods and bundler are you using? 🤔

cipolleschi avatar Mar 18 '23 19:03 cipolleschi

The error is something like: undefined method 'map' for nil:NilClass from the last line of the log.

Which is weird.

Which version of Ruby and Cocoapods and bundler are you using? 🤔

I fixed it. Installed the ruby 2.7.6 in x86 enviroment not for arm64. Thanks.

popking5466 avatar Mar 30 '23 01:03 popking5466

I solved this problem by deleting a vendor directory and running a bundle install and then pod install --repo-update

arthurhts avatar Apr 19 '23 01:04 arthurhts

did anyone find solution

hassanharoon321 avatar May 18 '23 11:05 hassanharoon321

Hi @hassanharoon321! what's your specific problem?

If you setup the environment as suggested by the guide and use the ruby bundler properly, it should work with no issues.

Are you running bundle install (<-- needed only once) and bundle exec pod install in the ios directory?

cipolleschi avatar May 22 '23 09:05 cipolleschi

what I try:

  1. delete vendor folder not work
  2. arch -arm64 pod install --repo-update not work.

my react-native info:

OS: macOS 13.3.1
    CPU: (8) x64 Apple M2
    Shell: 3.6.1 - /opt/homebrew/bin/fish
  Managers:
    CocoaPods: Not Found
 npmPackages:
    react-native: 0.71.10 => 0.71.10 

it's confused CocoaPods not found. but I run which pod got /Users/j/.rbenv/shims/pod.

worked for me:

  1. update Xcode. Xcode Version 14.2 (14C18) to Xcode Version 14.3.1 (14E300c). this step maybe not key step.
  2. remove installed CocoaPods by gem. gem uninstall cocoapods
  3. install CocoaPods by brew. brew install cocoapods
  4. cd react-native project and run cd ios && bundle exec pod install --repo-update

microJ avatar Jun 15 '23 03:06 microJ

This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Dec 12 '23 05:12 github-actions[bot]