douglasjunior / react-native-keyboard-manager

⚛ Library to prevent issues of keyboard sliding up and cover inputs on React-Native iOS projects.
https://www.npmjs.com/package/react-native-keyboard-manager
MIT License
971 stars 59 forks source link

Pod install failed on m1 machine #104

Closed vnylbscr closed 1 year ago

vnylbscr commented 1 year ago

I added library to project after that I ran pod install command. This command failed.

Error

LoadError - dlopen(/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file (/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle), but incompatible platform (have 'iOS', need 'macOS')), '/System/Volumes/Preboot/Cryptexes/OS/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (no such file), '/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file (/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle), but incompatible platform (have 'iOS', need 'macOS')) - /Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi_c.bundle
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi.rb:5:in `rescue in <top (required)>'
/Users/mert/.gem/ruby/3.2.0/gems/ffi-1.15.5/lib/ffi.rb:2:in `<top (required)>'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
/Users/mert/.gem/ruby/3.2.0/gems/ethon-0.16.0/lib/ethon.rb:3:in `<top (required)>'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
/Users/mert/.gem/ruby/3.2.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
<internal:/opt/homebrew/Cellar/ruby/3.2.1/lib/ruby/3.2.0/rubygems/core_ext/kernel_require.rb>:88:in `require'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:78:in `deprecated_local_podspecs'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:60:in `preheat_existing_files'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-core-1.12.0/lib/cocoapods-core/cdn_source.rb:257:in `update'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:144:in `block (3 levels) in update'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:143:in `block (2 levels) in update'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:142:in `each'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:142:in `block in update'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:140:in `open'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/sources_manager.rb:140:in `update'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:146:in `block in update_repositories'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:144:in `each'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer/analyzer.rb:144:in `update_repositories'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:240:in `block in resolve_dependencies'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/user_interface.rb:64:in `section'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:239:in `resolve_dependencies'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/installer.rb:162:in `install!'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/command/install.rb:52:in `run'
/opt/homebrew/lib/ruby/gems/3.2.0/gems/claide-1.1.0/lib/claide/command.rb:334:in `run'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:52:in `run'
/Users/mert/.gem/ruby/3.2.0/gems/cocoapods-1.12.0/bin/pod:55:in `<top (required)>'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `load'
/opt/homebrew/Cellar/cocoapods/1.11.3_1/libexec/bin/pod:25:in `<main>'

Stack

   CocoaPods : 1.12.0
        Ruby : ruby 3.2.1 (2023-02-08 revision 31819e82c8) [arm64-darwin21]
    RubyGems : 3.4.6
        Host : macOS 13.3.1 (22E261)
       Xcode : 14.3 (14E222b)
         Git : git version 2.39.2 (Apple Git-143)
Ruby lib dir : /opt/homebrew/Cellar/ruby/3.2.1/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, '12.4'
install! 'cocoapods', :deterministic_uuids => false

pod 'Firebase', :modular_headers => true
pod 'FirebaseCoreInternal', :modular_headers => true
pod 'GoogleUtilities', :modular_headers => true
pod 'FirebaseCore', :modular_headers => true

production = ENV["PRODUCTION"] == "1"

target 'KocfinansPusula' do
  config = use_native_modules!

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

  use_react_native!(
    :path => config[:reactNativePath],
    # to enable hermes on iOS, change `false` to `true` and then install pods
    :production => production,
    :hermes_enabled => flags[:hermes_enabled],
    :fabric_enabled => flags[:fabric_enabled],
    :flipper_configuration => FlipperConfiguration.enabled,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

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

  post_install do |installer|
    react_native_post_install(installer)
    __apply_Xcode_12_5_M1_post_install_workaround(installer)
  end
end

package.json

"dependencies": {
    "@expo/react-native-action-sheet": "^4.0.1",
    "@gorhom/bottom-sheet": "^4",
    "@notifee/react-native": "^7.4.0",
    "@react-native-async-storage/async-storage": "^1.17.10",
    "@react-native-clipboard/clipboard": "^1.11.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/netinfo": "^9.3.7",
    "@react-native-firebase/analytics": "^17.3.2",
    "@react-native-firebase/app": "^17.1.0",
    "@react-native-firebase/messaging": "^17.1.0",
    "@react-native-picker/picker": "^2.4.8",
    "@react-navigation/bottom-tabs": "^6.5.2",
    "@react-navigation/drawer": "^6.5.6",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@shopify/restyle": "^2.1.0",
    "@tanstack/react-query": "^4.3.9",
    "axios": "^0.27.2",
    "i18next": "^22.0.1",
    "i18next-http-backend": "^1.4.4",
    "jail-monkey": "^2.8.0",
    "lottie-react-native": "^5.1.4",
    "moment": "^2.29.4",
    "react": "18.0.0",
    "react-hook-form": "^7.36.1",
    "react-i18next": "^11.18.6",
    "react-native": "0.69.9",
    "react-native-confirmation-code-field": "^7.3.1",
    "react-native-countdown-circle-timer": "^3.0.9",
    "react-native-date-picker": "^4.2.6",
    "react-native-device-info": "^10.3.0",
    "react-native-exit-app": "^1.1.0",
    "react-native-gesture-handler": "^2.8.0",
    "react-native-get-random-values": "^1.8.0",
    "react-native-image-picker": "^5.0.2",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-keyboard-manager": "^6.5.11-1",
    "react-native-localize": "^2.2.4",
    "react-native-modal": "^13.0.1",
    "react-native-pager-view": "^6.2.0",
    "react-native-picker-select": "^8.0.4",
    "react-native-reanimated": "^2.12.0",
    "react-native-root-toast": "^3.4.1",
    "react-native-safe-area-context": "^4.4.1",
    "react-native-screens": "^3.18.2",
    "react-native-splash-screen": "^3.3.0",
    "react-native-svg": "^13.5.0",
    "react-native-tab-view": "^3.5.1",
    "uuid": "^9.0.0",
    "zustand": "^4.1.1"
  },
douglasjunior commented 1 year ago

Sorry, but it is not related to the library itself.

We have used this library in many projects and M1 machines with no problem.

Please double-check your cocoapods and ffi installation.

vnylbscr commented 1 year ago

If I remove this package, everything works fine. Are you sure this problem not about this package?

douglasjunior commented 1 year ago

It's probably a coincidence, because when installing this package cocoapods uses some "ffi" routine that your project hasn't used yet.

And if you had problems with this package, most likely you will also have problems with others that use native libraries.

nabeelanjum commented 1 year ago

I am also facing this problem and I am sure I have ffi setup properly

douglasjunior commented 1 year ago

If you want to create a project and upload it to Github, I can take a look.

But, here we are using different versions of React Native, with Mac Intel and M1, with cocoapods 1.11 and 1.12, without any problem.

nabeelanjum commented 1 year ago

@douglasjunior thanks man! but I've found the issue and it is related to MacOS Ventura. This helped me: https://github.com/CocoaPods/CocoaPods/issues/11627#issuecomment-1294998876