Skip to content

template init w/3rd party dependencies might fail if pod repo out of date #752

@mikehardy

Description

@mikehardy

Environment

This is a bug in the CLI during template init, so react-native info is not that useful. However, the command starts with npx @react-native-community/cli ... so the version should be current, even though the --version apparently doesn't produce output as a temporary thing...

Description

This is interesting to @Salakar and @thymikee

This is related to:

If a user attempts to install a template with 3rd party modules, it can fail if the 3rd party modules include cocoapods dependencies that aren't present yet in the user's cocoapods repo

Stated differently and more specifically: the react-native-firebase v6 starter template currently (could change in the future...) requires the iOS Firebase SDK Pods at version 6.8.1, and if the user hasn't updated their repo since that version was released, the cli init will fail because pod repo needs to update, but it does not.

Reproducible Demo

First you have to make sure you don't have the requested cocoapod version, then you have to try the init. For me that is:

\rm -fr ~/.cocoapods/repos/master/Specs/0/3/5/Firebase/6.8.1
npx @react-native-community/cli init --template=@react-native-firebase/template TestProject

output:

                                                          
               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               
                                                          

                  Welcome to React Native!                
                 Learn Once Write Anywhere                

✔ Downloading template
✔ Copying template
✔ Processing template
✔ Installing dependencies
⠋ Installing CocoaPods dependencies (this may take a few minutes)Using firebase.json from '/Users/mike/work/react-random/TEMP/TestProject/firebase.json'
Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration
Detected React Native module pod for RNFBApp
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `Folly` from `../node_modules/react-native/third-party-podspecs/Folly.podspec`
Fetching podspec for `RNFBApp` from `../node_modules/@react-native-firebase/app`
Fetching podspec for `React` from `../node_modules/react-native/`
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-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 `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Fetching podspec for `yoga` from `../node_modules/react-native/ReactCommon/yoga`
[!] CocoaPods could not find compatible versions for pod "Firebase/Core":
  In Podfile:
    RNFBApp (from `../node_modules/@react-native-firebase/app`) was resolved to 6.0.0, which depends on
      Firebase/Core (~> 6.8.1)

None of your spec sources contain a spec satisfying the dependency: `Firebase/Core (~> 6.8.1)`.

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.

✖ Installing CocoaPods dependencies (this may take a few minutes)
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./TestProject/ios && pod install".
CocoaPods documentation: https://cocoapods.org/

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions