React Native: Podfiles causing name collusions

what is podfile
cocoapods semver
podfile use_frameworks
cocoapods zsh
cocoapods repository
podfile commit hash
cocoapods optimistic operator
cocoapods branch dependency

I am getting an error:

Ambiguous resolution: module ".../myModule.js" tries to require 'react-native', but there are several files providing this module. You can delete or fix them:

.../MyProject/ios/Pods/React/package.json

.../MyProject/node_modules/react-native/package.json

I am almost certain that this is due to using Podfiles, specifically, when they install the "React" folder. However, I had to use Podfiles in order to install react-native-firebase. With that said, when I delete the React folder under my Pods folder (ios/Pods/React), I can no longer use react-native-firebase.

There was a fix floating around GitHub, which suggested appending the Podfile with:

post_install do |installer|
  installer.pods_project.targets.each do |target|
    if target.name == "React"
      target.remove_from_project
    end
  end
end

But this did not work for me. Has anyone encountered this problem before?

If it is relevant, this is the podfile that I am using:

platform :ios, '8.0'

target 'MyProject2' do
    pod 'Firebase/Core'
    pod 'Firebase/Database'
    pod 'Firebase/Messaging'

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

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

  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end
    end
  end

end

EDIT: When I remove the 'RNSVG' from my Podfile, I get an error stating: "Invariant Violation: Native component for 'RNSVGPath' does not exist". I have both ran react-native link and followed the instructions for manual installation for react-native-svg.

I had to manually link the React pod to node_modules:

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

React Native: Podfiles causing name collusions - reactjs - html, However, I had to use Podfiles in order to install react-native-firebase. With that said, when I delete the React folder under my Pods folder (ios/Pods/React), I can​  user8951490. Apparently, this user prefers to keep an air of mystery about them. 5 React Native: Podfiles causing name collusions Mar 21 '18. 4 Paho MQTT

I just finished managing this problem when making my app work for iOS.

I used Chris' solution and also...

The haste packaging manager was finding instances of my modules both from my root node_modules folder and from the node_modules folder inside my Build folder.

To solve that, create a file called rn-cli.config.js in the root of your project:

const blacklist = require('metro-config/src/defaults/blacklist');


module.exports = {
resolver: {
blacklistRE: blacklist([
                        /Build\/.*/,
                        ])
},
};

facebook/react-native, This error didn't occur before as naming collisions were silently allowed, Naming collision detected by packager when using cocoapods #3440 which both have react-native installed and thus cause a name collision (as  quadsurf changed the title This Library is Causing a Naming Collision Help With Naming Collision Jan 7, 2017

This problem seems to happen anytime a Pod is added with a React dependency.

Once something has a react dependency and the React Pod is not added, it will often attempt to install it, finding an old version of React on CocoaPods (0.11).

To avoid this, you need to add the dependency and required subdependencies explicitly, per the documentation for react-native here: react-native cocoapods docs.

For instance, when I added the react-native-community/async-storage module, I had to add all of this to my podfile which previously had only AppCenter and Firebase related dependencies:

  pod 'React', :path => '../node_modules/react-native', :subspecs => [
    'Core',
    'CxxBridge', # Include this for RN >= 0.47
    'DevSupport', # Include this to enable In-App Devmenu if RN >= 0.43
    'RCTText',
    'RCTNetwork',
    'RCTWebSocket', # Needed for debugging
    'RCTAnimation', # Needed for FlatList and animations running on native UI thread
# Add any other subspecs you want to use in your project
  ]
  # Explicitly include Yoga if you are using RN >= 0.42.0
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

Issue #25393 · facebook/react-native, As far as I can see this doesn't cause issues but we can find another solution if it does. git clone git@github.com:jtreanor/react-native-cocoapods-frameworks.git Question: is the issue here header namespace collisions across podspecs? In CocoaPods, the .framework name defaults to header_dir , or module_name if  jest-haste-map: Haste module naming collision: react-native The following files share their name; please adjust your hasteImpl: * < rootDir > / node_modules / react-native / package. json * < rootDir > /.. /.. / node_modules / @ react-native-community / async-storage / node_modules / react-native / package. json Failed to construct transformer

Taking a look at react-native-svg, their Podfile specifies React as a dependency. To keep things simple, I would suggest that you use the recommended react-native link command to install this library rather than specifying it within the Podfile.

Once you've removed react-native-svg you will probably want to clear down your Podfile folder and re-run pod install

Using CocoaPods, Check the Specs repository or cocoapods.org to make sure the libraries you So for example if you are writing an iOS app, it would be the name of your Running pod install will install the current version of RestKit, causing a Podfile.​lock to  Issue The React pod, which is one of RNFirebase's dependencies, has been deprecated. A minimal Podfile looks something like platform :ios, '9.0' target 'ReactNativePlayground' do pod 'Firebase/Core' pod 'RNFirebase', :path => '../node_mo

Firebase iOS Release Notes, Fixed symbol collisions with the legacy Fabric Crashlytics SDK and added a warning not to include Cleaned up the event parameter names displayed in the debug logs. Fixes an iOS 13 beta crash caused by a race condition with Remote Config. If you have pod 'Firebase/Core' in the Podfile, no change is necessary. This may cause temporary UI inconsistencies between native and React Native. This is a known problem and our team is working on synchronizing UI updates coming from different sources. Note: React Native does not perform any layout calculations until the root view becomes a subview of some other views.

Analytics for iOS, Android · React Native · Xamarin · iOS First, add the Analytics dependency to your Podfile , like so: It removes the string “ViewController” from the name (if present). common events with our Native Mobile Spec, such as the Application Installed That will cause symbol conflicts/namespace collisions. Layout of a React Native component embedded in native React Native content with fixed size. The general scenario is when we have a React Native app with a fixed size, which is known to the native side. In particular, a full-screen React Native view falls into this case. If we want a smaller root view, we can explicitly set RCTRootView's frame.

Upgrade to React Native 0.60, Struggling to upgrade to the latest version of React Native? It's a multi-step process and missing one of the steps can lead to hard to debug issues. These libraries are mostly the same, however, the package names have all been changed. If you are not currently using Cocoapods for linking, then it is recommended  edited Please remove the example folder from your npm package it causes naming collisions with the existing react-native package, since react-native gets installed twice and the bundler fails to transform. A temporary fix for all you people who are experiencing the same, please add this to your package.json

Comments
  • Brilliant, but I found I also needed to add a subspecs section!
  • When I do that, I get a "Invariant Violation: Native component for 'RNSVGPath' does not exist". Even though, I have both ran 'react-native link' and followed the steps for manual installation of react-native-svg.
  • From my observations, react-native link adds the library to the Podfile, so this should produce the same effect.