Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native - npx react-native run-ios doesn't work after initializing the project

After reading https://reactnative.dev/docs/environment-setup, I created a react-native project using npx react-native init ***.

It was successful, so, I tried to run the project using npx react-native run-ios, and got the below error:

** BUILD FAILED **


The following build commands failed:
    CompileC /Users/loser/Library/Developer/Xcode/DerivedData/test0205-dasunahpjpavelgmslwgmvjhesxy/Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/Flipper.build/Objects-normal/x86_64/FlipperRSocketResponder.o /Users/loser/Documents/projects/test0205/ios/Pods/Flipper/xplat/Flipper/FlipperRSocketResponder.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
like image 835
Everest Climber Avatar asked Feb 05 '21 11:02

Everest Climber


People also ask

How do I run React Native projects on Android?

Plug in your device via USB # Let's now set up an Android device to run our React Native projects. Go ahead and plug in your device via USB to your development machine. Now check that your device is properly connecting to ADB, the Android Debug Bridge, by running adb devices.

How do I run a react-native app in iOS simulator?

Once you have your React Native project initialized, you can run npx react-native run-ios inside the newly created project directory. If everything is set up correctly, you should see your new app running in the iOS Simulator shortly.

Which node should I upgrade to react native?

If you want to use react native 0.68 I recommend you upgrade Node to the last LTS. had same issue and upgrading to latest node worked for me.

How do I Find my device's IP address in React Native?

Open the command prompt and type ipconfig to find your machine's IP address ( more info ). Make sure your laptop and your phone are on the same Wi-Fi network. Open your React Native app on your device. You'll see a red screen with an error.


4 Answers

It's because of use_flipper in Podfile for iOS project.

use_flipper!

So, I was needed to indicate Flipper-Folly version with use_flipper as

use_flipper!({ 'Flipper-Folly' => '2.3.0' })

It worked perfectly after that change.

like image 169
Everest Climber Avatar answered Oct 17 '22 22:10

Everest Climber


Following Everest Climber answer

  1. In Podfile under ios/ folder

    Change use_flipper! to use_flipper!({ 'Flipper-Folly' => '2.3.0' })

  2. cd ios
  3. pod install
  4. pod update
  5. cd .. && npx react-native run-ios (to run the application)

This worked for me. Hopefully, it works for you too

like image 24
Suulola Avatar answered Oct 17 '22 22:10

Suulola


I could solve this issue after disabling Flipper in ios/Podfile.

  1. Fix Podfile as shown in below image

enter image description here

  1. cd ios
  2. delete Pods folder and Podfile.lock
  3. pod install
  4. pod update
  5. cd .. && npx react-native run-ios
like image 18
Prime Avatar answered Oct 17 '22 21:10

Prime


This issue is caused by flipper-folly pod spec updates

Remove/uninstall react-native-cli, just use npx

Try this on react-native 0.63.4 (previous stable version).

Remember it doesn't work for latest 0.64.0 with XCode 12.5

Inside ios/Podfile replace use_flipper! with:

use_flipper!({ 'Flipper-Folly' => '2.5.3', 'Flipper' => '0.87.0','Flipper-RSocket' => '1.3.1' })

pod install --repo-update

npx react-native run-ios

if you don't need to use flipper or still getting some issues try commenting out flipper inside podfile and install pods using command

pod install --repo-update

#use_flipper!()
  #post_install do |installer|
    #flipper_post_install(installer)
  #end
like image 6
Ashwin J Avatar answered Oct 17 '22 22:10

Ashwin J