react-native

React Native can't build ios after upgrading to 0.74.1. Redefinition of module 'ReactCommon'


I've followed the upgrade helper to a tee. Then I upgrade other dependencies to the latest versions. Next running pod install, that had a few glitches that I fix by removing Pods folder and the lockfile, and added use_modular_headers! to Podfile for some reason Firebase pod won't install without it. Then when I built for iOS, I got this error...

/Users/marko/App/Livestream/ios/Pods/Headers/Public/ReactCommon/ReactCommon.modulemap:1:8: error: redefinition of module 'ReactCommon'
module ReactCommon {
       ^
/Users/marko/App/Livestream/ios/Pods/Headers/Public/ReactCommon/React-RuntimeApple.modulemap:1:8: note: previously defined here
module ReactCommon {
       ^
1 error generated.

I was expecting the upgrade was much simpler... can I just rename one of the ReactCommon?


Solution

  • Okay, I've fixed it. Slowly comparing with a new project.

    I believe the issue is with use_modular_headers!. However, Firebase isn't happy without it, pod install won't go through... so I tried manually adding Firebase pod in the project Podfile, so it's like this:

    #remove global `use_modular_headers`
    #use_modular_headers!
    
    target 'Livestream' do
      config = use_native_modules!
    
      # add indvidual modular_headers => true as shown in
      # "...depends upon..." pod install error message:
    
      pod 'FirebaseCore', :modular_headers => true;
      pod 'GoogleUtilities', :modular_headers => true;
    

    Now everyone's happy. Hopefully this helps you guys as well.