Async-storage: fatal error: 'React/RCTBridgeModule.h' file not found

Created on 30 Apr 2019  路  71Comments  路  Source: react-native-async-storage/async-storage

Current behavior

After adding Async Storage build fails with fatal error: 'React/RCTBridgeModule.h' file not found.

info In file included from /Users/.../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m:8:
/Users/.../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.h:8:9: fatal error: 'React/RCTBridgeModule.h' file not found

info #import <React/RCTBridgeModule.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~

info 1 error generated.
The following build commands failed:
    CompileC /Users/.../ios/build/.../Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/RNCAsyncStorage.build/Objects-normal/x86_64/RNCAsyncStorage.o /Users/.../node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

Environment

  • Async Storage version: ^1.3.3
  • React-Native version: 0.59.5
  • Platform tested: iOS

Screenshot 2019-04-30 11 03 25

bug iOS

Most helpful comment

Same issue after upgrading to RN 0.61.1

All 71 comments

I found that this issue appears when you add use_frameworks! to your Podfile

For me using manual linking only, without using Cocoapods, helped - https://github.com/react-native-community/react-native-async-storage/blob/master/docs/Linking.md#project-linking

Same here. Getting this error, when I use pods.

Found this thread while having this issue, but not with this actual repo.
The problem was that I still had not selected a development team for my reactnative xcodeproj (both regular target and the tests-target). But that blocked all building, so the dependencies also didn't build. When I selected a dev team, the build started working and this issue when away during the build.

Hey everyone,

I've thought something broke recently, so I went ahead and created a project from scratch (using pods).

Here's my Podfile:

target 'YOUR_PROJECT_NAME' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!
  platform :ios, '9.0'


  node_modules_path = '../node_modules'

  pod 'yoga', path: "#{node_modules_path}/react-native/ReactCommon/yoga/yoga.podspec"
  pod 'React', path: "#{node_modules_path}/react-native"

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

end

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

Maybe you forgot to include React in your build?

Also, like @sebwib said (thanks btw.), the issue you're seeing could come from the Parallelize Build option selected, where modules are build simultaneously, when your project is dependant on React Native.

Please check if it's the case. You can check it in your Scheme options (CMD + '<').
SS:

Screenshot 2019-05-03 at 14 09 17

thanks.

@Krizzu Will it break if you uncomment use_frameworks!? I suspect this is an issue with React Native and not AsyncStorage (or maybe both).

In any case, someone using react-native-maps seems to have solved the issue here: https://github.com/react-native-community/react-native-maps/issues/2324.

@tido64 Yup, using use_frameworks breaks it for me.

Same here breaks with or without use_frameworks !
back to react-native link 鉁堬笍

my podfile :


# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'MY_APP' do
  # Payment
  pod 'Stripe', '~> 14.0.0'

  pod 'AppCenter/Push', '~> 1.13.2'
  pod 'AppCenter/Crashes', '~> 1.13.2'
  pod 'AppCenter/Analytics', '~> 1.13.2'
  pod 'AppCenterReactNativeShared', '~> 1.12.2'
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  use_frameworks!

  platform :ios, '9.0'

  pod 'tipsi-stripe', :path => '../node_modules/tipsi-stripe'

  # Maybe reove that.
  pod 'RNIap', :path => '../node_modules/react-native-iap'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

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

end

same problem here :/

We are facing same issue with React-Native version: 0.59.5

@roadev @sagargondaliya Can you provide bit more details? We're trying to nail down this problem, so any info is helpful.

thanks.

@Krizzu Recently we have upgraded our workspace to support 64bit architectures in Android and for that we upgraded react native to 0.59.5 and after that iOS stops building with fatal error: 'React/RCTBridgeModule.h' file not found.

@sagargondaliya: Do you use components other than AsyncStorage as well? If so, as an experiment, could you remove it and see if it builds?

@Krizzu if that may help, this is our package.json when we tried to install the community edition.

 "dependencies": {
    "@moqada/rn-twemoji": "0.2.1",
    "@types/react": "^16.8.15",
    "adm-zip": "0.4.13",
    "apollo-cache-inmemory": "1.4.3",
    "apollo-cache-persist": "0.1.1",
    "apollo-client": "2.4.13",
    "apollo-link": "1.2.8",
    "apollo-link-context": "1.0.14",
    "apollo-link-http": "1.5.11",
    "apollo-link-state": "0.4.2",
    "apollo-link-ws": "1.0.14",
    "apollo-utilities": "1.1.3",
    "appcenter": "1.12.2",
    "appcenter-analytics": "1.12.2",
    "appcenter-crashes": "1.12.2",
    "appcenter-push": "1.12.2",
    "cors": "2.8.5",
    "date-fns": "1.30.1",
    "format-json": "1.0.3",
    "graphql": "14.1.1",
    "graphql-tag": "2.10.1",
    "identity-obj-proxy": "3.0.0",
    "lodash": "4.17.11",
    "numeral": "2.0.6",
    "plist": "3.0.1",
    "prop-types": "15.7.2",
    "querystringify": "2.1.0",
    "ramda": "^0.26.1",
    "react": "16.8.3",
    "react-apollo": "2.4.1",
    "react-native": "0.59.5",
    "react-native-actionsheet": "2.4.2",
    "react-native-animatable": "1.3.1",
    "react-native-animate-number": "0.1.2",
    "react-native-app-link": "1.0.0",
    "react-native-code-push": "5.5.2",
    "react-native-communications": "2.2.1",
    "react-native-config": "0.11.7",
    "react-native-device-info": "0.26.4",
    "react-native-fbsdk": "0.8.0",
    "react-native-i18n": "git+https://github.com/CptFabulouso/react-native-i18n.git#patch-1",
    "react-native-iap": "2.4.8",
    "react-native-keyboard-aware-scroll-view": "0.8.0",
    "react-native-linear-gradient": "2.5.3",
    "react-native-payments": "0.7.1",
    "react-native-payments-addon-stripe": "^0.4.0",
    "react-native-permissions": "1.1.1",
    "react-native-platform-touchable": "1.1.1",
    "react-native-push-notification": "3.1.2",
    "react-native-splash-screen": "3.2.0",
    "react-native-svg": "9.4.0",
    "react-native-svg-charts": "5.2.0",
    "react-native-swipe-gestures": "1.0.3",
    "react-native-vector-icons": "6.2.0",
    "react-navigation": "2.18.2",
    "stacktrace-parser": "^0.1.6",
    "styled-components": "^4.2.0",
    "subscriptions-transport-ws": "0.9.15",
    "tipsi-stripe": "^7.5.0",
    "xcode": "2.0.0"
  },
  "devDependencies": {
    "@babel/core": "7.2.2",
    "@types/react-navigation": "^3.0.6",
    "babel-core": "7.0.0-bridge.0",
    "babel-eslint": "10.0.1",
    "babel-jest": "24.8.0",
    "babel-preset-env": "1.7.0",
    "eslint-config-airbnb": "17.1.0",
    "eslint-plugin-jsx-a11y": "6.2.1",
    "eslint-plugin-prettier": "3.0.1",
    "husky": "1.3.1",
    "ignite-animatable": "1.0.2",
    "ignite-i18n": "1.2.0",
    "ignite-ir-boilerplate-andross": "2.4.1",
    "ignite-magic-graphql": "0.0.3",
    "ignite-redux-persist": "1.1.0",
    "ignite-standard": "1.0.0",
    "ignite-vector-icons": "1.1.1",
    "jest": "24.8.0",
    "metro-react-native-babel-preset": "0.54.1",
    "mockery": "2.1.0",
    "prettier": "1.16.4",
    "react-dom": "16.8.1",
    "react-native-testing-library": "^1.7.0",
    "react-test-renderer": "16.8.6",
    "schedule": "0.5.0",
    "snazzy": "8.0.0",
    "standard": "12.0.1"
  },

@Lucas-Geitner Does your app build without AsyncStorage? Also, I can't see React Native in your Podfile. How do you link it?

Yes the build it's working, Ilink the binary directly in xcode, maybe this is where the error come from

@Lucas-Geitner: Yes, if you manually linked React Native, but used CocoaPods for AsyncStorage, there is no way for us to know where the React headers are. You'll need to go all in on either, or add the React header path in the project's header search path.

@alex-mironov, @sintylapse, @anarkafkas (and others having the original issue): can you check in your Podfile whether the following lines exist:

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

If it does, can you remove them, run pod install again, then re-build. I think what's happening is that React gets removed from the Pods project. RNCAsyncStorage has a target dependency on React to ensure that its headers are installed. With it removed, Xcode will build RNCAsyncStorage at any time, most often before React does.

I have tried by deleting node_modules, npm cache clean and tried with fresh installation. I have tried with manual linking, headers adding. Upgraded with latest version

"@react-native-community/async-storage": "^1.4.1"
"react-native": "0.59.1",

Please help me for this.

node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.h:10:9: fatal error: 'RNCAsyncStorage/RNCAsyncStorageDelegate.h' file not found

info #import
^~~~~~~~~~~

The following build commands failed:
CompileC ...ios/build/testapp/Build/Intermediates.noindex/RNCAsyncStorage.build/Debug-iphonesimulator/RNCAsyncStorage.build/Objects-normal/x86_64/RNCAsyncStorage.o ...node_modules/@react-native-community/async-storage/ios/RNCAsyncStorage.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)

@codoffer - Try to add with Manual installation and remove from pod file. It will resolved.

@Karanp13 - I have tried with manual also. I don't know, How to resolve this issue.

@codoffer Do you use Expo? Did you restart the app after linking?

I am not using Expo. I have cleaned the build (using xCode) and tried to run with connected device and emulator both.

@codoffer Can you provide a repo that I can look into?

@codoffer - I hope that you set build system as 'Legacy Build System' in Workspace.

@Krizzu @Karanp13 - Now its weird situation.
When I am trying to run with emulator and getting same error using - react-native run-ios
Its working without error via xCode Achieve.

Any idea. How to fix this?

@codoffer - Please try to change and make new derived data path and call - 'react-native link' in root directory.
Clean the build and run it again.

@Karanp13 - Thanks for reply. Now I am doing some temporary fixes to RUN and trying complete this application. Application works fine with - "react-native start -- --reset-cache" and changing values of import file with RNCAsyncStorage.h every run.

import

TO

import "RNCAsyncStorageDelegate.h"

@codoffer Can you try the steps in Troubleshooting?

The Problem is with the new React-native 0.59.x

I fixed it by adding React and Yoga references to the Pod file, to make sure CocoaPod gets React dependency from node_modules instead of creating a new directory and pulling from other repo.

  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'


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

I used this method and it worked properly

remove this line in podfile:
pod 'RNCAsyncStorage', :path => '.....

manual link carefully, also make sure that React.xcodeproj appears with RNCAsyncStorage.xcodeproj
build again

Closing this one down, as it looks like it's fixed.

@Krizzu With what comment has it been fixed?

Currently experincing this myself when pod installing


The pod file

target 'DiwalaMobile' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  node_modules_path = '../node_modules'

  # See http://facebook.github.io/react-native/docs/integration-with-existing-apps.html#configuring-cocoapods-dependencies

  # React Native paths, needed for better integration
  # React native path for easier change between monorepo and not
  # Your 'node_modules' directory is probably in the root of your project,
  # but if not, adjust the `:path` accordingly  
  rn_path = "#{node_modules_path}/react-native" 

  pod 'React', :path => rn_path, :subspecs => [
    'CxxBridge', # Include this for RN >= 0.47
    'Core',
    '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 => "#{rn_path}/ReactCommon/yoga"

  # Third party deps podspec link
  pod 'DoubleConversion', :podspec => "#{rn_path}/third-party-podspecs/DoubleConversion.podspec"
  pod 'glog', :podspec => "#{rn_path}/third-party-podspecs/glog.podspec"
  pod 'Folly', :podspec => "#{rn_path}/third-party-podspecs/Folly.podspec"

  # Pods for DiwalaMobile
  # Required by RNFirebase
  pod 'Firebase/Core', '~> 5.20.1'
  pod 'GoogleAppMeasurement', '5.8.0'
  pod 'Firebase/Messaging'
  pod 'Firebase/Database'
  pod 'Firebase/Auth'

  # Intercom SDK
  pod 'Intercom'

  # Other injections of react native libraries
  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

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

   # this is needed to avoid including multiple references to react.
  post_install do |installer|
    installer.pods_project.targets.each do |target|
      if target.name == "React"
        target.remove_from_project
      end

      targets_to_ignore = %w(React yoga)

      if targets_to_ignore.include? target.name
        target.remove_from_project
      end
    end
  end

end

I just dont see any good solutions here? I checked parallized.
Im coming from the same situation as @sagargondaliya. Upgrading 64 bit for android and facing to ue this package, which now fails for iOS

I had to manually link to get it to work. But im running a monorepo, maybe there are some strangeness then? And some libs are hoisted

I am also having same issue. I tried using pods and manual linking. I am using new empty project and installing only AsyncStorage without any luck. I am using RN 0.59.10.
Following @sagarv1997 suggestion, i get build succeeded, but MetroBuilder throws this error now:

Loading dependency graph...(node:2332) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/Test3/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/react-native/package.json

This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
    at workerReply (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2332) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:2332) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2332) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/Test3/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/react-native/package.json

This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
    at workerReply (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:2332) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/Test3/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/react-native/package.json

This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
    at workerReply (/Users/home/Desktop/APLIKACE/RNTests/Test3/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)

@vongohren There was no activity for some time, so I assumed it has been dealt with. Reopening then.

Have you checked the troubleshooting guide for Pods ?

@LukePenkava Can you link your Podfile?

@Krizzu Can you please try to repro the issue, if you cant repro the error, i will upload repo.

Steps to repro:

react-native init TestProject --version 0.59.10
pod init
yarn add @react-native-community/async-storage
react-native link @react-native-community/async-storage
pod install
react-native run-ios

This causes 'React/RCTBridgeModule.h' file not found error

Adding these to the Podfile fixes the RCTBridgeModule error and build is successful, but causes the metro builder i posted in previous message.

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

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

@Krizzu checked now, and was hopeful. But it is the same problem.
Now I have even not hoisted the async storage. But the react-native is hoisted meaning that it can struggle to find the header somewhere else. But I have added a symlink for react-native, so the folder exists in node_modules, and most of my other libs are able to find react-native.

There can be a problem in following the symlink as I have experienced this before.
But I acctually struggle to no hoist react native beacuse of some jest problems, but that is for another issue.

With a no hoisted async-storage, and if I link it manually, it works fine for some reason. What might be the difference?

Pod install won't work as we need to give path for respective 'RNCAsyncStorage.podspec' file in our project's pod file.

Add pod 'RNCAsyncStorage', :podspec => '../node_modules/@react-native-community/async-storage/RNCAsyncStorage.podspec' to your pod file and everything will work. No need to do manual linking.

Let me know if this works for anyone.

@paritosh-yadav I tried it as you suggested. I did this installation:

react-native init testproject --version 0.59.10
cd ios
pod init
cd ..
yarn add @react-native-community/async-storage
( edit pod file to look like this )

platform :ios, '9.0'

target 'testasync2' do
  # Pods for testasync2
  pod 'RNCAsyncStorage', :podspec => '../node_modules/@react-native-community/async-storage/RNCAsyncStorage.podspec'

end

cd ios
pod install
cd ..
react-native run-ios

I get following errors:

error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening testasync2.xcworkspace

metro bundler error

Loading dependency graph...(node:9563) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/react-native/package.json

This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (/Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
    at workerReply (/Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:9563) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:9563) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:9563) UnhandledPromiseRejectionWarning: Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: /Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/ios/Pods/React/package.json collides with /Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/react-native/package.json

This error is caused by `hasteImpl` returning the same name for different files.
    at setModule (/Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/metro/node_modules/jest-haste-map/build/index.js:569:17)
    at workerReply (/Users/home/Desktop/APLIKACE/RNTests/test5/testasync2/node_modules/metro/node_modules/jest-haste-map/build/index.js:641:9)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:9563) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)

Can you please check if this happesn to you as well or if i am doing something wrong during the installation ?

@LukePenkava Hi, I've followed your steps and I could recreate 65 error.

I've fixed it by adding missing deps. My Podfile:

platform :ios, '9.0'

target 'async' do
  #use_frameworks!

  pod 'React', :path => '../node_modules/react-native'
  pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
  pod 'Folly', :podspec => '../node_modules/react-native/third-party-podspecs/Folly.podspec'
  pod 'DoubleConversion', :podspec => '../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec'

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'


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

end

@Krizzu Thanks a lot. Its working now.

@LukePenkava Happy to hear that. Good luck with the project.

i get this error when I run ur podfile modified so it also pulls other libraries for my project:

[!] Unable to find a specification for React-Core (= 0.60.4) depended upon by React

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.

still facing the issue:
react-native : 0.59.10

`# Uncomment the next line to define a global platform for your project

platform :ios, '9.0'

target 'project name' do
# Uncomment the next line if you're using Swift or would like to use dynamic frameworks
# use_frameworks!
node_modules_path = '../node_modules'
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
pod 'Firebase/Analytics', '~> 5.20.1'
pod 'Firebase/Auth', '~> 5.20.1'
pod 'Firebase/Firestore', '~> 5.20.1'
pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'
pod 'react-native-netinfo', :path => '../node_modules/@react-native-community/netinfo'

end

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

here is my bundler
`Loading dependency graph...(node:37317) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: path~/ios/Pods/React/package.json collides with /Users/codalyze/dev/mssa-sports-app/node_modules/react-native/package.json

This error is caused by hasteImpl returning the same name for different files.
(node:37317) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:37317) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 3): Error: jest-haste-map: Haste module naming collision:
Duplicate module name: react-native
Paths: my-file-path~/ios/Pods/React/package.json collides with my-file-path~/node_modules/react-native/package.json
`

i have linked it using CLI command and also manual linking, but same error
image

what to do? any lead would be great.

@AshishCd Can you edit your command and make it more readable by using github markdown?. I think that there's an extra end in your Podfile but I can't tell for sure due to bad formatting.

This did the magic,
https://www.youtube.com/watch?v=JnZS5MoYKCY
You just need to add React in scheme.

Same issue after upgrading to RN 0.61.1

I'd need more info about setup/Pods you have to help

@kennym You should not need to add this dep to your cocoapods. Please compare your cocoapods file to the react-native-example app. Also compare the use_frameworks option and use_native_modules option.

Same problem with @kennym on several libs after upgrading from RN 0.60.5 to 0.61.1. The errors are:

  • 'React/UIView+React.h' file not found
  • 'React/RCTBridgemodule.h' file not found
    ...

Already reported to RN in this issue

FYI, I only used use_native_modules!, not use_framework!

For me using manual linking only, without using Cocoapods, helped - https://github.com/react-native-community/react-native-async-storage/blob/master/docs/Linking.md#project-linking

Link not working

I didn't use cocoapods锛孖 also got this error

Here's the correct link to manual linking guide

I had this issue when i updated from 58 -> 61.2.

I Fixed by deleting the contents of the Libraries folder in the xCode Project.

Does anyone have a fix for this ?

@niv-breez have you tried to removing node_modules/cleaning build project?

yes.
working with react-native 0.60 + (without expo).
this is my pod file:

platform :ios, '9.0'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

target 'breez' do

  # Firebase pods
  pod 'Firebase/Core', '~> 6.3.0'
  pod 'Firebase/Messaging', '~> 6.3.0'
  pod 'Firebase/Analytics'
  pod 'Firebase/Performance'

  # Pods for breez
  pod 'React', :path => '../node_modules/react-native/'
  pod 'React-Core', :path => '../node_modules/react-native/React'
  pod 'React-DevSupport', :path => '../node_modules/react-native/React'
  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'

  # Pods for permissions
  permissions_path = '../node_modules/react-native-permissions/ios'
  pod 'Permission-Camera', :path => "#{permissions_path}/Camera.podspec"

  # Pods for PodTest
  pod 'Fabric', '~> 1.10.2'
  pod 'Crashlytics', '~> 3.14.0'

  pod 'GoogleSignIn', '~> 5.0.0'

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

  use_native_modules!
end

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

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

end

Just follow proper Upgrade Instructions using Upgrade Tool.

I actually missed that there are two times pod for React and React-Core: (had different but similar issue with BVLinearGradient missing RCTView.h file)

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

Isso fez a m谩gica,
https://www.youtube.com/watch?v=JnZS5MoYKCY
Voc锚 s贸 precisa adicionar o React no esquema.

Cara, queria saber pq esse React nao aparece pra mim com esse icone de lib, aparece com esse circulo vermelho.

@Renathesco Aqui tbm.

Getting Same Error on newly created project with PODS.
In Version "react-native": "0.61.5", Any solution for this??

Unfortunately I have the same error here.

I'd require more info about (for example, Podfile) to be able to help here.

I'd require more info about (for example, Podfile) to be able to help here.

Things I have tried:

  1. Add React to Target.
  2. Clear cache, delete DerivedData, delete node_modules, reinstall pods
  3. set defaults delete com.apple.dt.Xcode
  4. I tried this solution
  5. And this solution
  6. Added (and remove) :
    post_install do |installer| installer.pods_project.targets.each do |target| if target.name == "React" target.remove_from_project end end end
  7. comment and uncomment use_frameworks and platform: ios
    And others tricks...

This project was previously built by another developer. Apparently he did have a successful buid (not confirmed), this is the original podfile:

# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'

target 'AppName' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for AppName
  pod 'GoogleSignIn', '~> 4.4.0'
  pod 'Firebase/Core'

  pod 'react-native-image-picker', :path => '../node_modules/react-native-image-picker'
  pod 'RNIap', :path => '../node_modules/react-native-iap'

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

  pod 'RNCAsyncStorage', :path => '../node_modules/@react-native-community/async-storage'

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


  pod 'RNSentry', :path => '../node_modules/@sentry/react-native'

  pod 'lottie-ios', :path => '../node_modules/lottie-ios'

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

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

end

target 'AppName-tvOS' do
  # Uncomment the next line if you're using Swift or would like to use dynamic frameworks
  # use_frameworks!

  # Pods for AppName-tvOS

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

end

@devangelmotta I cannot see React Native in your Podfile. How do you link against React Native? Did you have a look at our troubleshooting guide? Specifically this point may help you:

_If you've manually linked React Native, but use CocoaPods for AsyncStorage, AsyncStorage will not be able to find React headers. You'll need to set header search path, or also consume React Native via CocoaPods._

We are facing same issue with React-Native version: 0.59.5

I also get that error with 0.59.9 and i have upgraded to 0.60.4 and the problem was resolved.

Any other ideas not mentioned above?
I am having the problem in RN 0.62.2.

Sometimes as last resort I just regenerate the whole project with React Native CLI

Thanks @RichardLindhout
Sounds like a last resort indeed...

  • I have a project that is working on android, using RN 0.59.9, but never tested on iOS.
  • I upgraded to RN 0.62.2 and fixed few issues in order to make it work on android.
  • Now I want to make it work on IOS.
  • Starting all over again means a lot of work, also for android.

It also makes sense to me that such a problem can be solved:

  • Doesn't Xcode use a well defined search path to resolve import statements (isn't this what the definition of build Settings -> Search path is supposed to define? Did I define it improperly?)
  • When I change the import statement to #import <RCTBridgeModule.h> the problem was gone, but: (1) this doesn't sound like the way to go, since when somebody will clone the repo and run npm i the problem will reappear, and (2) when I changed the import statement I get a similar error in another file, for #import <yoga/Yoga.h>.
  • I tried to change this import statement to the following: #import "../../ReactCommon/yoga/yoga/Yoga.h", and I am still getting an error.

I can't upgrade without it :). But the 0.59.9 > 0.60 was a big one with autolinking so quite some changes.

I upgraded for android and it didn't take too much time (I am using https://github.com/react-native-community/rn-diff-purge). So for iOS, where this is the first time to make it work, I do start from a new project, kind of...

Was this page helpful?
0 / 5 - 0 ratings