Search code examples
react-nativecocoapodsreact-native-iospodspecpodfile

Can't install react-native-unimodules on React Native 0.60.3


Installed with yarn install react-native-unimodules

The next step in the instructions required me to edit my project Podfile. The necessary additions were shown here.

Here is my resultant Podfile

platform :ios, '10.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'
require_relative '../node_modules/react-native-unimodules/cocoapods.rb'
target 'MyProjectName' do
  # Pods for MyProjectName
  pod 'React', :path => '../node_modules/react-native/', :subspecs => [
    'Core',
    'CxxBridge',
    'DevSupport',
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket',
    'RCTAnimation',
    'RCTImage',
  ]
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  pod 'React-fishhook', :path => '../node_modules/react-native/Libraries/fishhook'
  pod 'React-RCTActionSheet', :path => '../node_modules/react-native/Libraries/ActionSheetIOS'
  pod 'React-RCTAnimation', :path => '../node_modules/react-native/Libraries/NativeAnimation'
  pod 'React-RCTBlob', :path => '../node_modules/react-native/Libraries/Blob'
  pod 'React-RCTImage', :path => '../node_modules/react-native/Libraries/Image'
  pod 'React-RCTLinking', :path => '../node_modules/react-native/Libraries/LinkingIOS'
  pod 'React-RCTNetwork', :path => '../node_modules/react-native/Libraries/Network'
  pod 'React-RCTSettings', :path => '../node_modules/react-native/Libraries/Settings'
  pod 'React-RCTText', :path => '../node_modules/react-native/Libraries/Text'
  pod 'React-RCTVibration', :path => '../node_modules/react-native/Libraries/Vibration'
  pod 'React-RCTWebSocket', :path => '../node_modules/react-native/Libraries/WebSocket'

  pod 'React-cxxreact', :path => '../node_modules/react-native/ReactCommon/cxxreact'
  pod 'React-jsi', :path => '../node_modules/react-native/ReactCommon/jsi'
  pod 'React-jsiexecutor', :path => '../node_modules/react-native/ReactCommon/jsiexecutor'
  pod 'React-jsinspector', :path => '../node_modules/react-native/ReactCommon/jsinspector'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'
  pod 'glog', :podspec => '../node_modules/react-native/third-party-podspecs/glog.podspec'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  use_unimodules!

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

  use_native_modules!
end

target 'MyProjectName-tvOS' do
  # Pods for MyProjectName-tvOS

  target 'MyProjectName-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end

end

The next step is running pod install, which gives the following output/error:

$ pod install
Installing unimodules:
 [email protected] from ../node_modules/expo-app-loader-provider/ios
 [email protected] from ../node_modules/expo-constants/ios
 [email protected] from ../node_modules/expo-file-system/ios
 [email protected] from ../node_modules/expo-permissions/ios
 [email protected] from ../node_modules/unimodules-barcode-scanner-interface/ios
 [email protected] from ../node_modules/unimodules-camera-interface/ios
 [email protected] from ../node_modules/unimodules-constants-interface/ios
 [email protected] from ../node_modules/@unimodules/core/ios
 [email protected] from ../node_modules/unimodules-face-detector-interface/ios
 [email protected] from ../node_modules/unimodules-file-system-interface/ios
 [email protected] from ../node_modules/unimodules-font-interface/ios
 [email protected] from ../node_modules/unimodules-image-loader-interface/ios
 [email protected] from ../node_modules/unimodules-permissions-interface/ios
 [email protected] from ../node_modules/@unimodules/react-native-adapter/ios
 [email protected] from ../node_modules/unimodules-sensors-interface/ios
 [email protected] from ../node_modules/unimodules-task-manager-interface/ios

Analyzing dependencies
Fetching podspec for `EXAppLoaderProvider` from `../node_modules/expo-app-loader-provider/ios`
Fetching podspec for `EXConstants` from `../node_modules/expo-constants/ios`
Fetching podspec for `EXFileSystem` from `../node_modules/expo-file-system/ios`
Fetching podspec for `EXPermissions` from `../node_modules/expo-permissions/ios`
Fetching podspec for `React-Core` from `../node_modules/react-native/React`
Fetching podspec for `React-DevSupport` from `../node_modules/react-native/React`
Fetching podspec for `React-RCTActionSheet` from `../node_modules/react-native/Libraries/ActionSheetIOS`
Fetching podspec for `React-RCTAnimation` from `../node_modules/react-native/Libraries/NativeAnimation`
Fetching podspec for `React-RCTBlob` from `../node_modules/react-native/Libraries/Blob`
Fetching podspec for `React-RCTImage` from `../node_modules/react-native/Libraries/Image`
Fetching podspec for `React-RCTLinking` from `../node_modules/react-native/Libraries/LinkingIOS`
Fetching podspec for `React-RCTNetwork` from `../node_modules/react-native/Libraries/Network`
Fetching podspec for `React-RCTSettings` from `../node_modules/react-native/Libraries/Settings`
Fetching podspec for `React-RCTText` from `../node_modules/react-native/Libraries/Text`
Fetching podspec for `React-RCTVibration` from `../node_modules/react-native/Libraries/Vibration`
Fetching podspec for `React-RCTWebSocket` from `../node_modules/react-native/Libraries/WebSocket`
Fetching podspec for `React-cxxreact` from `../node_modules/react-native/ReactCommon/cxxreact`
Fetching podspec for `React-fishhook` from `../node_modules/react-native/Libraries/fishhook`
Fetching podspec for `React-jsi` from `../node_modules/react-native/ReactCommon/jsi`
Fetching podspec for `React-jsiexecutor` from `../node_modules/react-native/ReactCommon/jsiexecutor`
Fetching podspec for `React-jsinspector` from `../node_modules/react-native/ReactCommon/jsinspector`
Fetching podspec for `React` from `../node_modules/react-native/`
Fetching podspec for `UMBarCodeScannerInterface` from `../node_modules/unimodules-barcode-scanner-interface/ios`
Fetching podspec for `UMCameraInterface` from `../node_modules/unimodules-camera-interface/ios`
Fetching podspec for `UMConstantsInterface` from `../node_modules/unimodules-constants-interface/ios`
Fetching podspec for `UMCore` from `../node_modules/@unimodules/core/ios`
Fetching podspec for `UMFaceDetectorInterface` from `../node_modules/unimodules-face-detector-interface/ios`
Fetching podspec for `UMFileSystemInterface` from `../node_modules/unimodules-file-system-interface/ios`
Fetching podspec for `UMFontInterface` from `../node_modules/unimodules-font-interface/ios`
Fetching podspec for `UMImageLoaderInterface` from `../node_modules/unimodules-image-loader-interface/ios`
Fetching podspec for `UMPermissionsInterface` from `../node_modules/unimodules-permissions-interface/ios`
Fetching podspec for `UMReactNativeAdapter` from `../node_modules/@unimodules/react-native-adapter/ios`
Fetching podspec for `UMSensorsInterface` from `../node_modules/unimodules-sensors-interface/ios`
Fetching podspec for `UMTaskManagerInterface` from `../node_modules/unimodules-task-manager-interface/ios`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] CocoaPods could not find compatible versions for pod "React/Core":
  In Podfile:
    React/Core (from `../node_modules/react-native/`)

None of your spec sources contain a spec satisfying the dependency: `React/Core (from `../node_modules/react-native/`)`.

You have either:
 * out-of-date source repos which you can update with `pod repo update` or with `pod install --repo-update`.
 * mistyped the name or version.
 * not added the source repo that hosts the Podspec to your Podfile.

Note: as of CocoaPods 1.0, `pod repo update` does not happen on `pod install` by default.

Following the responses to a Github issue regarding this exact error output, I did a search of file contents for my entire project directory and did not get a hit for any place React-Core may be badly defined as React/Core.

This is my first time ever editing a Podfile, and I fear I may have fumbled something in the syntax.


Solution

  • React Native changed a lot of things in 0.60, one of them was to split React podspec into separate podspecs.

    That means that React podspec no longer has any subspecs. The error you're getting is React/Core, which used to be a subspec, is no longer available (it's now imported separately). To fix the problem, remove the subspecs from your Podfile:

    pod 'React', :path => '../node_modules/react-native/'
    pod 'React-Core', :path => '../node_modules/react-native/React'
    etc...
    

    Note that many tutorials and documentation you'll find on the web include the subspecs definitions. That's how things were done in React Native <=0.59, and are no longer valid in 0.60.