React-native-firebase: [馃敟] Invalid `RNFBAnalytics.podspec` No such file or directory @ rb_sysopen

Created on 27 Aug 2020  路  14Comments  路  Source: invertase/react-native-firebase


Issue



Hello Guys!

In our project we currently use the library @react-native-firebase/analytics: "7.3.1" and we upgrade to the version
7.5.1

When i run the pod install i get the following error

[!] Invalid `Podfile` file: 
[!] Invalid `RNFBAnalytics.podspec` file: No such file or directory @ rb_sysopen - ../app/package.json.

 #  from /Users/nameUser/.../root-project/packages/app/node_modules/@react-native-firebase/analytics/RNFBAnalytics.podspec:3
 #  -------------------------------------------
 #  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
 >  appPackage = JSON.parse(File.read(File.join('..', 'app', 'package.json')))
 #  
 #  -------------------------------------------

For more context we use a monorepo project with lerna, and the libraries are normally installed in the following path

root-project/node_modules

and when we update to @react-native-firebase/analytics:7.3.1 this is installed in the following route

root-project/packages/app/node_modules

So I think the reason for the exception to my question is why only the Analytics library is installed here and the others are installed in the correct path

in root-project/node_modules we have:
image

and in root-project/packages/app/node_modules we have
image

if i downgrade the version the package is installed correctly but with the new one i saw this behaviour,

there some issue o config that i need to make to have correctly?

Project Files






Javascript

Click To Expand

#### `package.json`: relevant versions of package.json

    "react-native": "0.63.2",
    "@react-native-firebase/analytics": "7.5.1",
    "@react-native-firebase/app": "8.4.0",
    "@react-native-firebase/crashlytics": "8.4.1",
    "@react-native-firebase/dynamic-links": "7.5.1",
    "@react-native-firebase/messaging": "7.8.1",
    "@react-native-firebase/remote-config": "8.2.1",
#### `firebase.json` for react-native-firebase v6:
{
  "react-native": {
    "crashlytics_ndk_enabled": true,
    "crashlytics_debug_enabled": true,
    "crashlytics_auto_collection_enabled": true
  }
}

### iOS
Click To Expand

#### `ios/Podfile`: - [ ] I'm not using Pods - [x] I'm using Pods and my Podfile looks like: require_relative '../../../node_modules/react-native/scripts/react_native_pods' require_relative '../../../node_modules/@react-native-community/cli-platform-ios/native_modules' .... ... config = use_native_modules! use_react_native!(:path => config[:reactNativePath]) ....

# N/A
#### `AppDelegate.m`:
// N/A


Android

Click To Expand

#### Have you converted to AndroidX? - [ ] my application is an AndroidX application? - [ ] I am using `android/gradle.settings` `jetifier=true` for Android compatibility? - [ ] I am using the NPM package `jetifier` for react-native compatibility? #### `android/build.gradle`:

// N/A
#### `android/app/build.gradle`:
// N/A
#### `android/settings.gradle`:
// N/A
#### `MainApplication.java`:
// N/A
#### `AndroidManifest.xml`:
<!-- N/A -->


Environment

Click To Expand

**`react-native info` output:**

System:
    OS: macOS 10.15.5
    CPU: (8) x64 Intel(R) Core(TM) i7-6820HQ CPU @ 2.70GHz
    Memory: 430.76 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.10.0 - ~/.nvm/versions/node/v12.10.0/bin/node
    Yarn: 1.22.4 - /usr/local/bin/yarn
    npm: 6.10.3 - ~/.nvm/versions/node/v12.10.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.9.3 - /usr/local/bin/pod
  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: 27.0.0, 27.0.3, 28.0.0, 28.0.3, 29.0.2
      System Images: android-24 | Google Play Intel x86 Atom, android-29 | Google APIs Intel x86 Atom, android-29 | Google Play Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 4.0 AI-193.6911.18.40.6514223
    Xcode: 11.6/11E708 - /usr/bin/xcodebuild
  Languages:
    Java: 1.8.0_231 - /usr/bin/javac
    Python: 2.7.16 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: Not Found
    react-native: * => 0.63.2 
- **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:** - `7.5.1` - **`Firebase` module(s) you're using that has the issue:** - `Analytics,App` - **Are you using `TypeScript`?** - Y




Needs Triage Bug

Most helpful comment

Fantastic that you found it! This might strike other people, so I really appreciate you came back and provided the extra information in case it helps someone else. I see you're in 'CDMX', cheers from the South in Ecuador :)

All 14 comments

That seems really weird that it'd end up there given that app does not have analytics as a dependency, analytics does have app as a peer dependency though.

Perhaps make sure your other rnfirebase dependencies are up to date? Can see all the latest cross compatible versions here: https://github.com/invertase/react-native-firebase/blob/master/tests/package.json#L9

I was definitely just in that podspec, but I have no idea how what I touched could have this effect?

https://github.com/invertase/react-native-firebase/commit/728f41863832d21230c6eb1f55385284fef03c09#diff-1b79ce6d1a8e1a2f03b0f8539367d02f

Especially when the changes in other modules are using are identical :thinking:

https://github.com/invertase/react-native-firebase/commit/728f41863832d21230c6eb1f55385284fef03c09#diff-0fa4b9b85885f232095dc6c84a86fcce

This may have been happening (the unexpected install behavior in your project) all along, but if you look at my diff, only now will you be seeing it

It used to be that if a non-@react-native-firebase/app package could not find ../app/package.json it would use a fallback version of the firebase-ios-sdk, but I removed that fallback because

  1. @react-native-firebase/app is a strict requirement for all other packages (so ../app/package.json should always be there?) and
  2. with the version spread out everywhere, tracking upstream firebase-ios-sdk was error-prone (unnecessarily, to my way of thinking)

So my hunch is you've had the package installation misplacement all along, but only now is it evident.

Is very strange i compare this dependencies https://github.com/invertase/react-native-firebase/blob/master/tests/package.json#L9

with ours dependencies and are the same :/

image

and if i downgrade analytics to 7.3.1 that is installed with the other dependencies corrrectly
image

Can you bisect (sort like this but manually, if you haven't bisected before) the versions to find the patch version it breaks? https://github.com/invertase/react-native-firebase/blob/master/packages/analytics/CHANGELOG.md

Ufff is a great idea @mikehardy i made the exercise,

I tested since the last and i found this 7.5.1, 7.5.0, 7.4.2 , 7.4.1, 7.4.0 had the issue, but when i try 7.3.1 or 7.3.0
i had no issue, so i think the problem start in the version 7.4.0

@mikehardy I don't see anything in that version that could be the reason that causes that strange behavior.

In the worst case, I can create a script in the post-install to move it to the correct place after the yarn install

in case you can't think of anything that might cause that?

Fantastic digging thanks for doing that, gives us a much better idea of what to look for. Also confirms that my change was the proximate cause (it exposed the problem) but was not the actual cause.

But...what the heck?? :sweat_smile: - nothing in that diff looks suspect https://github.com/invertase/react-native-firebase/commit/e7b4bb31b05985c044b1f01625a43e364bb653ef

I am very confused. Perhaps a look at your monorepo's root package.json would shed light? I also use react-native-firebase in a monorepo but I keep all the RNFB stuff in the packages/public-app/node_modules/

I can't think of anything right now, I wish I could

There may be others with this problem as my change that would expose this sort of problem just went live this afternoon, definitely worth keeping open to collect any other reports / learn from others

My issue can be connected to the one that you are having.
I was using in my project those versions and everything worked fine

"@react-native-firebase/analytics": "^7.4.1",
"@react-native-firebase/app": "^8.3.0",

But today suddenly my builds started failing with the following message:
```[!] CocoaPods could not find compatible versions for pod "Firebase/Analytics":
In snapshot (Podfile.lock):
Firebase/Analytics (= 6.28.1, ~> 6.28.1)

In Podfile:
RNFBAnalytics (from ../node_modules/@react-native-firebase/analytics) was resolved to 7.4.1, which depends on
Firebase/Analytics (~> 6.30.0)

You have either:

  • changed the constraints of dependency Firebase/Analytics inside your development pod RNFBAnalytics.
    You should run pod update Firebase/Analytics to apply changes you've made.

[!] NPM package '@react-native-firebase/analytics' depends on '@react-native-firebase/app' v8.3.0 but found v8.4.0, this might cause build issues or runtime crashes.


I had to change the @react-native-firebase/analytics version to 7.3.1 and remove ^ from package.json

"@react-native-firebase/analytics": "7.3.1",
"@react-native-firebase/app": "8.3.0",

```

any ideas what causes this issue?

@agnieszkabugla totally different issue - you just need to delete Podfile.lock and pod install again. Something about the way react-native-firebase pulls in the firebase-ios-sdk doesn't like doing the updates simply, but podfile lock recreation does the trick

(going to mark these as off-topic not because they are important to you - just that they aren't actually related to the main topic, no offense please :-) )

@mikehardy I already found the problem for this 馃帀

In the monorepo that we have, we use different packages to distribute the logic, the @react-native-firebase/analytics library was being used in another package with the previous version

That is why it is when doing the yarn install, lerna to solve it, it put the larger version inside the app package instead of root package

So the solution was only to match the versions in the packages and voila

Thank you very much for the fast response and an apology for the false alarm

Fantastic that you found it! This might strike other people, so I really appreciate you came back and provided the extra information in case it helps someone else. I see you're in 'CDMX', cheers from the South in Ecuador :)

Was this page helpful?
0 / 5 - 0 ratings