facebook/flipper

Question: [!] Invalid `Podfile` file: uninitialized constant Pod::Podfile::FlipperConfiguration.

mhkasif opened this issue ยท 12 comments

# require_relative '../node_modules/react-native/scripts/react_native_pods'
# require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
  'require.resolve(
    "react-native/scripts/react_native_pods.rb",
    {paths: [process.argv[1]]},
  )', __dir__]).strip

platform :ios, 16
prepare_react_native_project!

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# ```
flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled(["Release","Debug"], { 'Flipper' => '0.212.0' })

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
  Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
  use_frameworks! :linkage => linkage.to_sym
end

target 'Ola' do
  config = use_native_modules!
  pod 'FirebaseAuth', :modular_headers => true
  pod 'FirebaseCore', :modular_headers => true
  pod 'FirebaseCoreExtension', :modular_headers => true
  pod 'FirebaseInstallations', :modular_headers => true
  pod 'GoogleDataTransport', :modular_headers => true
  pod 'GoogleUtilities', :modular_headers => true
  pod 'nanopb', :modular_headers => true
  $RNFirebaseAsStaticFramework = true

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

  use_react_native!(
    :path => config[:reactNativePath],
    # Hermes is now enabled by default. Disable by setting this flag to false.
    # Upcoming versions of React Native may rely on get_default_flags(), but
    # we make it explicit here to aid in the React Native upgrade process.
    # :hermes_enabled => flags[:hermes_enabled],
    # :fabric_enabled => flags[:fabric_enabled],
    # Enables Flipper.
    #
    # Note that if you have use_frameworks! enabled, Flipper will not work and
    # you should disable the next line.
    :flipper_configuration => flipper_config,
    # An absolute path to your application root.
    :app_path => "#{Pod::Config.instance.installation_root}/.."
  )

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

  # post_install do |installer|
  #   react_native_post_install(
  #     installer,
  #     # Set `mac_catalyst_enabled` to `true` in order to apply patches
  #     # necessary for Mac Catalyst builds
  #     :mac_catalyst_enabled => false
  #   )
  #   __apply_Xcode_12_5_M1_post_install_workaround(installer)
  # end
  post_install do |installer|
    # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
    react_native_post_install(
      installer,
      config[:reactNativePath],
      :mac_catalyst_enabled => false,
      # :ccache_enabled => true
    )
  end

end

getting this error
RN: 0.74.0
react-native-flipper:0.212.0

I get the same issue. Has anyone managed to solve it?

I had the same exact same issue after I upgraded my react-native version to 0.74.0. I finally decided to revert back to my initial version which was 0.72.7 and it solved the issue.

I also reverted "@types/react": "18.2.79" to "^18.0.24", which was my initial version before upgrade.

I am getting this issue as well.
[!] Invalid Podfile` file: uninitialized constant Pod::Podfile::FlipperConfiguration.

from /Users/xxxxx/Documents/xxxxx/xxxxx_iOS/ios/Podfile:18

-------------------------------------------

# ```

flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

-------------------------------------------`

Debugging React Native apps with Flipper is deprecated in React Native 0.73.

In my use case, I don't use Flipper. So I removed them in Podsfile.
Line 18

...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),

```

#flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled

Line 43

you should disable the next line.

#:flipper_configuration => flipper_config,

An absolute path to your application root.

Basically put # before the Flipper line on the two lines.

Then run "pod install" inside "iOS" folder.

It will run for a while. For me it took few minutes.
Pod install took 286 [s] to run

Mine run below, just a snippet and not all

Installing React-runtimescheduler 0.74.0 (was 0.72.4)
Installing React-utils 0.74.0 (was 0.72.4)
Installing ReactCommon 0.74.0 (was 0.72.4)
Installing SocketRocket 0.7.0 (was 0.6.1)
Installing Yoga 0.0.0 (was 1.14.0)
Installing boost 1.83.0 (was 1.76.0)
Installing fmt 9.1.0 (was 6.2.1)
Installing hermes-engine 0.74.0 (was 0.72.4)
Removing Flipper
Removing Flipper-Boost-iOSX
Removing Flipper-DoubleConversion
Removing Flipper-Fmt
Removing Flipper-Folly
Removing Flipper-Glog
Removing Flipper-PeerTalk
Removing FlipperKit
Removing OpenSSL-Universal
Removing YogaKit
Removing libevent
Generating Pods project
Start to replace ....
Fix: ../node_modules/react-native/React/Base/RCTKeyCommands.m
Fix: ../node_modules/react-native/React/Base/RCTKeyCommands.m
Fix: ../node_modules/react-native/React/Base/RCTKeyCommands.m
Fix: ../node_modules/react-native/React/DevSupport/RCTPackagerClient.h
Fix: ../node_modules/react-native/React/DevSupport/RCTPackagerConnection.mm
Setting USE_HERMES build settings
Setting REACT_NATIVE build settings

orome commented

Debugging React Native apps with Flipper is deprecated in React Native 0.73.

How do I enforce that in an Expo app?

I am not in Expo.
Can you put # on the Flipper at Podfile? This are only two lines as stated above.
Then run "pod install" in iOS folder.
After that it will automatically delete the Flipper since this is not used anymore by React Native after 0.73.

orome commented

I am not in Expo. Can you put # on the Flipper at Podfile? This are only two lines as stated above. Then run "pod install" in iOS folder. After that it will automatically delete the Flipper since this is not used anymore by React Native after 0.73.

Podfiles are abstracted away in Expo, so no, unfortunately.

Same issue, using RN 0.74.0

Invalid Podfile file: uninitialized constant Pod::Podfile::FlipperConfiguration.

@orome
Podfiles are abstracted away in Expo, so no, unfortunately.

they aren't actually, you can run npx expo prebuild -p ios to generate the Podfile. (this is called continuous native generation).

can someone share a minimal reproducible example?

I would love to upgrade to React Native 0.74. According to the React documentation, Flipper can still be used, but this bug is currently preventing the upgrade.

@ChrisWiles - can you share a minimal reproducible example?