Cannot run project for ios after upgrading from sdk33 to sdk36

Hi, I’ve upgraded my project to sdk 36 (from 33) yesterday and now realise that sdk36 is on react-native version 0.61.4 (thus, with auto-linking).

I’m not able to run the project on the ios simulator. Native packages previously installed with react-native link suddenly don’t work. I’m getting the error message below:

error React Native CLI uses auto-linking for native dependencies, but the following modules are linked manually: 
  - react-native-gesture-handler (to unlink run: "react-native unlink react-native-gesture-handler")
  - react-native-reanimated (to unlink run: "react-native unlink react-native-reanimated")
This is likely happening when upgrading React Native from below 0.60 to 0.60 or above. Going forward, you can unlink this dependency via "react-native unlink <dependency>", and it will be included in your app automatically. If a library isn't compatible with auto-linking, disregard this message and notify the library maintainers.
Read more about auto-linking: https://github.com/react-native-community/cli/blob/master/docs/autolinking.md
error Could not find the following native modules: react-native-appearance, RNBackgroundFetch, RNGestureHandler, react-native-image-resizer, react-native-maps, RNReanimated, RNScreens, RNSVG. Did you forget to run `pod install`?

Of course, I’ve followed the installation instructions for each package, namely the pod install bit. I’ve also unlinked and yarn remove all of them before I reinstall them.

This is what my Podfile used to look like, in sdk33:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'

target 'letsjobit' do
  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.14.1",
    :subspecs => [
      "Core"
    ],
    :inhibit_warnings => true

  # Install unimodules
  require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  use_unimodules!(
    modules_paths: ['../node_modules'],
    exclude: [
      'expo-face-detector',
      'expo-payments-stripe',
    ],
  )

  pod 'React',
    :path => "../node_modules/react-native",
    :inhibit_warnings => true,
    :subspecs => [
      "Core",
      "ART",
      "RCTActionSheet",
      "RCTAnimation",
      "RCTCameraRoll",
      "RCTGeolocation",
      "RCTImage",
      "RCTNetwork",
      "RCTText",
      "RCTVibration",
      "RCTWebSocket",
      "DevSupport",
      "CxxBridge"
    ]
  pod 'yoga',
    :path => "../node_modules/react-native/ReactCommon/yoga",
    :inhibit_warnings => true
  pod 'DoubleConversion',
    :podspec => "../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec",
    :inhibit_warnings => true
  pod 'Folly',
    :podspec => "../node_modules/react-native/third-party-podspecs/Folly.podspec",
    :inhibit_warnings => true
  pod 'glog',
    :podspec => "../node_modules/react-native/third-party-podspecs/glog.podspec",
    :inhibit_warnings => true

  pod 'BVLinearGradient', :path => '../node_modules/react-native-linear-gradient'
  pod 'react-native-image-resizer', :path => '../node_modules/react-native-image-resizer'
  pod 'RNBackgroundFetch', :path => '../node_modules/react-native-background-fetch'


  pod 'react-native-appearance', :path => '../node_modules/react-native-appearance'

  post_install do |installer|
    installer.pods_project.main_group.tab_width = '2';
    installer.pods_project.main_group.indent_width = '2';

    installer.target_installation_results.pod_target_installation_results
      .each do |pod_name, target_installation_result|

      if pod_name == 'ExpoKit'
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'EX_DETACHED=1'

          # Enable Google Maps support
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS=1'
          config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'HAVE_GOOGLE_MAPS_UTILS=1'

        end
      end


      if ['Amplitude-iOS','Analytics','AppAuth','Branch','CocoaLumberjack','FBSDKCoreKit','FBSDKLoginKit','FBSDKShareKit','GPUImage','JKBigInteger2'].include? pod_name
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
        end
      end

      # Can't specify this in the React podspec because we need to use those podspecs for detached
      # projects which don't reference ExponentCPP.
      if pod_name.start_with?('React')
        target_installation_result.native_target.build_configurations.each do |config|
          config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
          config.build_settings['HEADER_SEARCH_PATHS'] ||= ['$(inherited)']
        end
      end

      # Build React Native with RCT_DEV enabled and RCT_ENABLE_INSPECTOR and
      # RCT_ENABLE_PACKAGER_CONNECTION disabled
      next unless pod_name == 'React'
      target_installation_result.native_target.build_configurations.each do |config|
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)']
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_DEV=1'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'RCT_ENABLE_INSPECTOR=0'
        config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] << 'ENABLE_PACKAGER_CONNECTION=0'
      end

    end
  end
end

This is my Podfile now, at sdk 36:

platform :ios, '10.0'

require_relative '../node_modules/react-native-unimodules/cocoapods'

target 'letsjobit' do

  rnPrefix = "../node_modules/react-native"

  # React Native and its dependencies
  pod 'FBLazyVector', :path => "#{rnPrefix}/Libraries/FBLazyVector"
  pod 'FBReactNativeSpec', :path => "#{rnPrefix}/Libraries/FBReactNativeSpec"
  pod 'RCTRequired', :path => "#{rnPrefix}/Libraries/RCTRequired"
  pod 'RCTTypeSafety', :path => "#{rnPrefix}/Libraries/TypeSafety"
  pod 'React', :path => "#{rnPrefix}/"
  pod 'React-Core', :path => "#{rnPrefix}/"
  pod 'React-CoreModules', :path => "#{rnPrefix}/React/CoreModules"
  pod 'React-RCTActionSheet', :path => "#{rnPrefix}/Libraries/ActionSheetIOS"
  pod 'React-RCTAnimation', :path => "#{rnPrefix}/Libraries/NativeAnimation"
  pod 'React-RCTBlob', :path => "#{rnPrefix}/Libraries/Blob"
  pod 'React-RCTImage', :path => "#{rnPrefix}/Libraries/Image"
  pod 'React-RCTLinking', :path => "#{rnPrefix}/Libraries/LinkingIOS"
  pod 'React-RCTNetwork', :path => "#{rnPrefix}/Libraries/Network"
  pod 'React-RCTSettings', :path => "#{rnPrefix}/Libraries/Settings"
  pod 'React-RCTText', :path => "#{rnPrefix}/Libraries/Text"
  pod 'React-RCTVibration', :path => "#{rnPrefix}/Libraries/Vibration"
  pod 'React-Core/RCTWebSocket', :path => "#{rnPrefix}/"
  pod 'React-Core/DevSupport', :path => "#{rnPrefix}/"
  pod 'React-cxxreact', :path => "#{rnPrefix}/ReactCommon/cxxreact"
  pod 'React-jsi', :path => "#{rnPrefix}/ReactCommon/jsi"
  pod 'React-jsiexecutor', :path => "#{rnPrefix}/ReactCommon/jsiexecutor"
  pod 'React-jsinspector', :path => "#{rnPrefix}/ReactCommon/jsinspector"
  pod 'ReactCommon/jscallinvoker', :path => "#{rnPrefix}/ReactCommon"
  pod 'ReactCommon/turbomodule/core', :path => "#{rnPrefix}/ReactCommon"
  pod 'Yoga', :path => "#{rnPrefix}/ReactCommon/yoga"
  pod 'DoubleConversion', :podspec => "#{rnPrefix}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rnPrefix}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rnPrefix}/third-party-podspecs/Folly.podspec"

  # Other native modules
  # pod 'RNGestureHandler', :podspec => '../node_modules/react-native-gesture-handler/RNGestureHandler.podspec'
  # pod 'RNReanimated', :podspec => '../node_modules/react-native-reanimated/RNReanimated.podspec'

  # Automatically detect installed unimodules
  use_unimodules!
end

I have produced this Podfile by creating a new project with expo init and extracting the Podfile from it.

Other relevant info:

Expo CLI 3.11.2 environment info:
    System:
      OS: macOS 10.15.2
      Shell: 5.0.7 - /usr/local/bin/bash
    Binaries:
      Node: 10.16.0 - ~/.nvm/versions/node/v10.16.0/bin/node
      Yarn: 1.17.3 - ~/.nvm/versions/node/v10.16.0/bin/yarn
      npm: 6.12.0 - ~/.nvm/versions/node/v10.16.0/bin/npm
      Watchman: 4.6.0 - /usr/local/bin/watchman
    IDEs:
      Android Studio: 3.0 AI-171.4443003
      Xcode: 11.3/11C29 - /usr/bin/xcodebuild
    npmPackages:
      @types/react: ^16.8.23 => 16.9.16 
      @types/react-native: ^0.60.2 => 0.60.25 
      @types/react-navigation: 3.0.7 => 3.0.7 
      expo: ^36.0.0 => 36.0.1 
      react: 16.9.0 => 16.9.0 
      react-native: https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz => 0.61.4 
      react-navigation: ^3.11.0 => 3.13.0 
    npmGlobalPackages:
      expo-cli: 3.11.2

I really don’t know what to do here, so I would appreciate your help. Cheers, Joao

Did you ever solve this problem? Dealing with it right now.

In theory you just need to unlink all of the things you previously linked, but I would probably create a new app, eject it and then compare and/or copy things across. (Note: I have not tried ejecting an app, but I’ve heard from someone else who has an ExpoKit app who basically does this when upgrading.)

Are you getting the autolinking error after unlinking the dependencies it’s complaining about?

Also, are you using ExpoKit or the Bare workflow?

I have a similar Pod file setup. For anyone else who is encountering this when migrating to 36, what you may be missing is this line from the expo kit 36 upgrade section:

  # Install React Native and its dependencies
  require_relative '../node_modules/react-native/scripts/autolink-ios.rb'
  use_react_native!

and then you can remove or comment out the subspecs section

so like this:

  pod 'ExpoKit',
    :git => "http://github.com/expo/expo.git",
    :tag => "ios/2.14.1",
    :subspecs => [
      "Core",
    ],
    :inhibit_warnings => true

  # Install React Native and its dependencies
  require_relative '../node_modules/react-native/scripts/autolink-ios.rb'
  use_react_native!
    
  # Install unimodules
  require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
  use_unimodules!

#  pod 'React',
#   :path => rn_path,
#   :subspecs => [
#    'Core',
#    'CxxBridge',
...
#   ]

It seems to be working for me - give it a try.

1 Like