Hari Honor
Hari Honor

Reputation: 8914

Unable to find a specification for "React-Codegen"

I'm trying to upgrade an inherited project from React Native 0.64 to 0.68. I'm encountering a number of Cocoapod related errors, particularly around React-Codegen which no longer exists as a podspec in the react-native npm package.

The strange thing is I can't any reference online to others having this problem with this particular podspec. This usually means there is something else wrong for which this is a "red herring".

Below is a subset of my Podfile. I'm wondering whether setup has changed such that I no longer need all of these pod dependencies to be explicitly declared? Anyone have any ideas?

  pod 'React', :path => '../node_modules/react-native/', :modular_headers => false
  pod 'React-Core', :path => '../node_modules/react-native/', :modular_headers => false
  pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules', :modular_headers => false
  pod 'React-Core/DevSupport', :path => '../node_modules/react-native/', :modular_headers => false
  pod 'React-perflogger', :path => "../node_modules/react-native/ReactCommon/reactperflogger", :modular_headers => false # dep for DevSupport
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS', :modular_headers => false
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation', :modular_headers => false
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob', :modular_headers => false
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image', :modular_headers => false
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS', :modular_headers => false
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network', :modular_headers => false
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings', :modular_headers => false
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text', :modular_headers => false
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration', :modular_headers => false
  pod 'React-Core/RCTWebSocket', :path => '../node_modules/react-native/', :modular_headers => false
  pod 'React-ART', :path => '../node_modules/react-native/Libraries/ART', :modular_headers => false  # No longer a pod

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact', :modular_headers => false 

Upvotes: 12

Views: 12777

Answers (4)

raphaelmerx
raphaelmerx

Reputation: 724

Was getting the same error with additional information Specs satisfying the `React-Codegen (from `build/generated/ios`)` dependency were found, but they required a higher minimum deployment target.

After changing the deployment target to 13.0 in the Podfile as per below, pod could find a compatible version of React-Codegen during pod install.

platform :ios, podfile_properties['ios.deploymentTarget'] || '13.0'

Upvotes: 2

Tho Nguyen
Tho Nguyen

Reputation: 11

Add this two lines on top of Podfile.

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

Then remove all RCT related pod. 'pod install' & just build project.

This scripts/react_native_pods.rb do all RCT stuff we need. You can try with a new project with react-native init to see the template Podfile. Its totally diferent than before. I tried on 0.69.5

Upvotes: -1

bdiallo
bdiallo

Reputation: 99

Add the below statement at the top of your application's Podfile:

require_relative '../node_modules/react-native/scripts/react_native_pods'

The file which we are requiring in the above step defines a method called use_react_native! which we need in the next step.

Now call the method use_react_native! just before your application's target name in the Podfile as below:

use_react_native! 
target 'Example' do
...
end

Finally, run the command pod install at the root of your application

$ pod install

Upvotes: 9

Marouen Chaouachi
Marouen Chaouachi

Reputation: 39

I got it!

apparently react create a script that contains all the standard pods needs for your build

so what I did so far was doing a react-native init to generate the default podfile which was so much different from the old one

here it is

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '11.0'
install! 'cocoapods', :deterministic_uuids => false

target 'onboardingF2fApp' do

    config = use_native_modules!

  # Pods for onboardingF2fApp
    pod 'GooglePlaces', '3.1.0'
    pod 'GooglePlacePicker'
    pod 'GoogleMaps'

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

    use_react_native!(
      :path => config[:reactNativePath],
      # to enable hermes on iOS, change `false` to `true` and then install pods
      :hermes_enabled => flags[:hermes_enabled],
      :fabric_enabled => flags[:fabric_enabled],
      # An absolute path to your application root.
      :app_path => "#{Pod::Config.instance.installation_root}/.."
    )

end

 post_install do |installer|
  react_native_post_install(installer)
__apply_Xcode_12_5_M1_post_install_workaround(installer)
 end

target 'onboardingF2fAppTests' do
  inherit! :search_paths
  # Pods for testing
end

end

basicaly this script replaces all of the pods in your post

require_relative '../node_modules/react-native/scripts/react_native_pods'

Upvotes: 1

Related Questions