invertase / react-native-firebase

🔥 A well-tested feature-rich modular Firebase implementation for React Native. Supports both iOS & Android platforms for all Firebase services.
https://rnfirebase.io
Other
11.64k stars 2.21k forks source link

🐛 Invalid `RNFBDynamicLinks.podspec` file: undefined method `[]' for nil:NilClass - Pod install fails #4204

Closed GhayoorUlHaq closed 4 years ago

GhayoorUlHaq commented 4 years ago

pod install fails after installing @react-native-firebase/dynamic-links using npm and throws error

Adding a custom script phase for Pod RNFBApp: [RNFB] Core Configuration

[!] Invalid `Podfile` file: 
[!] Invalid `RNFBDynamicLinks.podspec` file: undefined method `[]' for nil:NilClass.

 #  from /Users/mac/CuddlyNest/cn_mobile_react_app/node_modules/@react-native-firebase/dynamic-links/RNFBDynamicLinks.podspec:7
 #  -------------------------------------------
 #  coreVersionRequired = package['peerDependencies'][appPackage['name']]
 >  firebase_sdk_version = appPackage['sdkVersions']['ios']['firebase']
 #  if coreVersionDetected != coreVersionRequired
 #  -------------------------------------------
.

 #  from /Users/mac/CuddlyNest/cn_mobile_react_app/ios/Podfile:57
 #  -------------------------------------------
 #  
 >    use_native_modules!
 #  end
 #  -------------------------------------------

Project Files

package.json:

{
  "name": "xxxx",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint .",
    "env:dev": "node envs/set-environment.js development",
    "env:prod": "node envs/set-environment.js production"
  },
  "rnpm": {
    "assets": [
      "./src/assets/fonts/"
    ]
  },
  "dependencies": {
    "@ptomasroos/react-native-multi-slider": "^1.0.0",
    "@react-native-community/art": "^1.2.0",
    "@react-native-community/async-storage": "^1.7.1",
    "@react-native-community/blur": "^3.4.1",
    "@react-native-community/datetimepicker": "^2.3.2",
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/google-signin": "^4.0.3",
    "@react-native-community/picker": "^1.6.1",
    "@react-native-community/viewpager": "^3.3.0",
    "@react-native-firebase/app": "^6.2.0",
    "@react-native-firebase/dynamic-links": "^7.5.2",
    "@react-native-firebase/messaging": "^6.2.0",
    "@testing-library/react-native": "^5.0.3",
    "axios": "^0.19.2",
    "deepcopy": "^2.0.0",
    "es6-promise": "^4.2.8",
    "event-target-shim": "^5.0.1",
    "isomorphic-fetch": "^2.2.1",
    "jest-environment-jsdom": "^26.0.1",
    "jest-fetch-mock": "^3.0.3",
    "lodash.debounce": "^4.0.8",
    "moment-timezone": "^0.5.27",
    "react": "16.9.0",
    "react-dom": "^16.13.1",
    "react-native": "0.61.5",
    "react-native-actionsheet": "^2.4.2",
    "react-native-animatable": "^1.3.3",
    "react-native-calendars": "^1.220.0",
    "react-native-collapsible": "^1.5.2",
    "react-native-device-info": "^5.4.0",
    "react-native-fbsdk": "^1.1.1",
    "react-native-gesture-handler": "^1.5.2",
    "react-native-google-places-autocomplete": "^1.4.0",
    "react-native-i18n": "^2.0.15",
    "react-native-image-crop-picker": "^0.26.1",
    "react-native-image-gallery": "^2.1.5",
    "react-native-indicator": "^1.2.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.1",
    "react-native-keyboard-manager": "^4.0.13-16",
    "react-native-localization": "^2.1.6",
    "react-native-maps": "react-native-community/react-native-maps#d6f89bd",
    "react-native-material-textfield": "^0.16.1",
    "react-native-mock-render": "^0.1.9",
    "react-native-modal-datetime-picker": "^8.6.0",
    "react-native-paper": "^3.6.0",
    "react-native-picker": "^4.3.7",
    "react-native-reanimated": "^1.4.0",
    "react-native-root-toast": "^3.2.0",
    "react-native-screens": "^2.0.0-alpha.20",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-splash-screen": "^3.2.0",
    "react-native-swipeout": "^2.3.6",
    "react-native-swiper": "^1.6.0-nightly.5",
    "react-native-vector-icons": "^6.6.0",
    "react-native-webview": "^8.0.4",
    "react-navigation": "^4.0.10",
    "react-navigation-redux-helpers": "^4.0.1",
    "react-navigation-stack": "^1.10.3",
    "react-navigation-tabs": "^2.6.2",
    "react-navigation-transitions": "^1.0.12",
    "react-redux": "^7.1.3",
    "redux": "^4.0.4",
    "redux-logger": "^3.0.6",
    "redux-persist": "^5.10.0",
    "redux-thunk": "^2.3.0",
    "socket.io-client": "^2.3.0",
    "tipsi-stripe": "^7.5.3"
  },
  "devDependencies": {
    "@babel/core": "^7.6.2",
    "@babel/runtime": "^7.6.2",
    "@react-native-community/eslint-config": "^0.0.5",
    "babel-jest": "^24.9.0",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.2",
    "eslint": "^6.5.1",
    "eslint-config-prettier": "^6.7.0",
    "eslint-plugin-prettier": "^3.1.2",
    "jest": "^24.9.0",
    "jsdom": "16.2.2",
    "jsdom-global": "3.0.2",
    "metro-react-native-babel-preset": "^0.56.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "verbose": true,
    "moduleFileExtensions": [
      "js",
      "json",
      "jsx",
      "ts",
      "tsx",
      "node",
      "map"
    ],
    "preset": "react-native",
    "transformIgnorePatterns": [
      "node_modules/(?!react-native|react)/"
    ],
    "setupFiles": [
      "<rootDir>/testCases/jest-setup.js"
    ],
    "globals": {
      "__DEV__": true
    },
    "testEnvironment": "node"
  }
}

iOS

Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: ```ruby platform :ios, '9.0' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' target 'myapp' do # Pods for myapp pod 'FBLazyVector', :path => "../node_modules/react-native/Libraries/FBLazyVector" pod 'FBReactNativeSpec', :path => "../node_modules/react-native/Libraries/FBReactNativeSpec" pod 'RCTRequired', :path => "../node_modules/react-native/Libraries/RCTRequired" pod 'RCTTypeSafety', :path => "../node_modules/react-native/Libraries/TypeSafety" pod 'React', :path => '../node_modules/react-native/' pod 'React-Core', :path => '../node_modules/react-native/' pod 'React-CoreModules', :path => '../node_modules/react-native/React/CoreModules' pod 'React-Core/DevSupport', :path => '../node_modules/react-native/' 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-Core/RCTWebSocket', :path => '../node_modules/react-native/' 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 'ReactCommon/jscallinvoker', :path => "../node_modules/react-native/ReactCommon" pod 'ReactCommon/turbomodule/core', :path => "../node_modules/react-native/ReactCommon" 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' pod 'RNGestureHandler', :path => '../node_modules/react-native-gesture-handler' pod 'RNReanimated', :path => '../node_modules/react-native-reanimated' pod 'RNScreens', :path => '../node_modules/react-native-screens' pod 'react-native-splash-screen', :path => '../node_modules/react-native-splash-screen' pod 'RNVectorIcons', :path => '../node_modules/react-native-vector-icons' pod 'ReactNativeLocalization', :path => '../node_modules/react-native-localization' pod 'Stripe', '~> 14.0.0' pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe' rn_maps_path = '../node_modules/react-native-maps' pod 'react-native-google-maps', :path => rn_maps_path pod 'GoogleMaps' pod 'Google-Maps-iOS-Utils' use_native_modules! end post_install do |installer| installer.pods_project.targets.each do |target| if target.name == "React" target.remove_from_project end end end ```


Environment

Click To Expand

**`react-native info` output:** ``` System: OS: macOS 10.15.4 CPU: (4) x64 Intel(R) Core(TM) i7-5557U CPU @ 3.10GHz Memory: 48.66 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 13.2.0 - /usr/local/bin/node Yarn: 1.19.2 - /usr/local/bin/yarn npm: 6.13.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.6, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2 Android SDK: API Levels: 23, 27, 28, 29 Build Tools: 28.0.3, 29.0.2, 29.0.3 System Images: android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom IDEs: Android Studio: 3.5 AI-191.8026.42.35.5791312 Xcode: 11.6/11E708 - /usr/bin/xcodebuild npmPackages: react: 16.9.0 => 16.9.0 react-native: 0.61.5 => 0.61.5 npmGlobalPackages: react-native-cli: 2.0.1 ``` - **Platform that you're experiencing the issue on**: - [x] iOS - [ ] Android - [ ] **iOS** but have not tested behavior on Android - [ ] **Android** but have not tested behavior on iOS - [ ] Both - **`react-native-firebase` version you're using that has this issue:** - `react-native-firebase/app: "^6.2.0"` - **`Firebase` module(s) you're using that has the issue:** - `@react-native-firebase/dynamic-links: "7.5.2"` - **Are you using `TypeScript`?** - `N`


mikehardy commented 4 years ago

Your firebase versions are old, update to latest and it should work I think

If it does not, the problem is still in your project somewhere, you can generate a throwaway project that works by cloning this repo and running this script: https://github.com/mikehardy/rnfbdemo/blob/master/make-demo.sh

The problem will be in how you have integrated react-native-firebase vs how the script does it

GhayoorUlHaq commented 4 years ago

Yes thanks, there was issue with version of firebase and dynamicLinks. Version for both should be same.