Wai Yan Hein
Wai Yan Hein

Reputation: 14831

Running "pod install" after creating new project is throwing error, "no suitable image found"

I am trying build a new IOS project using ReactNative. I am using the latest XCode version 12.5. I am having an issue running the app on IOS after installing the ReactNative project.

I created a new ReactNative project running the following command.

sudo npx create-react-native-app AnotherNewProject

After installation, I found this error in the console.

⚠️  Something went wrong running `pod install` in the `ios` directory. Continuing with initializing the project, you can debug this afterwards.

However I got into the project folder running the following command.

cd AnotherNewProject

Then I tried to run the app running the following command.

react-native run-ios

Then I got the following error.
$ react-native run-ios
error Could not find "Podfile.lock" at /Users/xandasupport/Desktop/Wais/AnotherNewProject/ios/Podfile.lock. Did you run "pod install" in iOS directory?
error Could not find the following native modules: RNGestureHandler, RNReanimated, RNScreens. Did you forget to run "pod install" ?
info Found Xcode project "AnotherNewProject.xcodeproj"
info Launching iPhone 11 (iOS 14.5)
info Building (using "xcodebuild -project AnotherNewProject.xcodeproj -configuration Debug -scheme AnotherNewProject -destination id=D45C835E-BC28-46DA-AD07-FA9D93E7CFBB")
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening AnotherNewProject.xcodeproj. Run CLI with --verbose flag for more details.
Command line invocation:

Then within the ios folder, I tried running the following command.

sudo pod install --allow-root

It is giving me the following error.

### Error

```
LoadError - dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi_c.bundle, 9): no suitable image found.  Did find:
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi_c.bundle: mach-o, but wrong architecture
    /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi_c.bundle: mach-o, but wrong architecture - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi_c.bundle
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi.rb:5:in `rescue in <top (required)>'
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/ethon-0.14.0/lib/ethon.rb:3:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/typhoeus-1.4.0/lib/typhoeus.rb:2:in `<top (required)>'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:74:in `cdn_url?'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:36:in `create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/sources_manager.rb:21:in `find_or_create_source_with_url'
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.1/lib/cocoapods/installer/analyzer.rb:178:in `block in sources'

What is wrong with the installation and how can I fix it?

Upvotes: 0

Views: 1083

Answers (1)

irufano
irufano

Reputation: 128

For M1 Macs. First uninstalling all gems that I did with normally

gem uninstall -aIx

Then changing the terminal to work with Rosetta

sudo gem install cocoapods

Upvotes: 1

Related Questions