Cocoapod错误,尝试在M1上安装所有可能的方式

Khu*_*ikh 9 cocoapods react-native-ios apple-m1

我收到这个错误

\n
Downloading template\n\xe2\x9c\x94 Copying template\n\xe2\x9c\x94 Processing template\n\xe2\x9c\x96 Installing CocoaPods dependencies (this may take a few minutes)\n\xe2\x9c\x96 Installing CocoaPods dependencies (this may take a few minutes)\nerror Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.\nPlease try again manually: "cd ./test/ios && pod install".\nCocoaPods documentation: https://cocoapods.org/\n
Run Code Online (Sandbox Code Playgroud)\n

当尝试手动安装时出现此错误,

\n
oadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle, 9): no suitable image found.  Did find:\n    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture\n    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi_c.bundle\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:5:in `rescue in <top (required)>\'\n/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.4/lib/ffi.rb:2:in `<top (required)>\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/Library/Ruby/Gems/2.6.0/gems/ethon-0.14.0/lib/ethon.rb:3:in `<top (required)>\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:440:in `download_typhoeus_impl_async\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:372:in `download_and_save_with_retries_async\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:365:in `download_file_async\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:338:in `download_file\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:284:in `ensure_versions_file_loaded\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/cdn_source.rb:208:in `search\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/aggregate.rb:83:in `block in search\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/aggregate.rb:83:in `select\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-core-1.11.0/lib/cocoapods-core/source/aggregate.rb:83:in `search\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:416:in `create_set_from_sources\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:385:in `find_cached_set\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:360:in `specifications_for_dependency\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:165:in `search_for\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:274:in `block in sort_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:267:in `each\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:267:in `sort_by\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:267:in `sort_by!\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:267:in `sort_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:60:in `block in sort_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:77:in `with_no_such_dependency_error_handling\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/delegates/specification_provider.rb:59:in `sort_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:754:in `push_state_for_requirements\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:288:in `push_initial_state\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:210:in `start_resolution\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolution.rb:168:in `resolve\'\n/Library/Ruby/Gems/2.6.0/gems/molinillo-0.8.0/lib/molinillo/resolver.rb:43:in `resolve\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/resolver.rb:94:in `resolve\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:1078:in `block in resolve_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface.rb:64:in `section\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:1076:in `resolve_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer/analyzer.rb:124:in `analyze\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:416:in `analyze\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:241:in `block in resolve_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/user_interface.rb:64:in `section\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:240:in `resolve_dependencies\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/installer.rb:161:in `install!\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command/install.rb:52:in `run\'\n/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:334:in `run\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/lib/cocoapods/command.rb:52:in `run\'\n/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.0/bin/pod:55:in `<top (required)>\'\n/usr/local/bin/pod:23:in `load\'\n/usr/local/bin/pod:23:in `<main>\'\n\n\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95 TEMPLATE END \xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\xe2\x80\x95\n\n[!] Oh no, an error occurred.\n\nSearch for existing GitHub issues similar to yours:\nhttps://github.com/CocoaPods/CocoaPods/search?q=dlopen%28%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle%2C+9%29%3A+no+suitable+image+found.++Did+find%3A%0A%09%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle%3A+mach-o%2C+but+wrong+architecture%0A%09%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle%3A+mach-o%2C+but+wrong+architecture+-+%2FLibrary%2FRuby%2FGems%2F2.6.0%2Fgems%2Fffi-1.15.4%2Flib%2Fffi_c.bundle&type=Issues\n\nIf none exists, create a ticket, with the template displayed above, on:\nhttps://github.com/CocoaPods/CocoaPods/issues/new\n\nBe sure to first read the contributing guide for details on how to properly submit a ticket:\nhttps://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md\n\nDon\'t forget to anonymize any private data!\n\nLooking for related issues on cocoapods/cocoapods...\nSearching for inspections failed: undefined method `map\' for nil:NilClass\n
Run Code Online (Sandbox Code Playgroud)\n

小智 31

嗨,这解决了我的问题

在终端中

sudo arch -x86_64 gem install ffi

在项目根目录中

cd ios && arch -x86_64 pod install && cd ../