react-native-async-storage / async-storage

An asynchronous, persistent, key-value storage system for React Native.
https://react-native-async-storage.github.io/async-storage/
MIT License
4.68k stars 465 forks source link

fatal error: 'React/RCTBridgeModule.h' file not found #91

Closed alex-mironov closed 5 years ago

alex-mironov commented 5 years ago

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

Screenshot 2019-04-30 11 03 25
chj-damon commented 4 years ago

I didn't use cocoapods,I also got this error

krizzu commented 4 years ago

Here's the correct link to manual linking guide

alexmbarton commented 4 years ago

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.

niv-breez commented 4 years ago

Does anyone have a fix for this ?

krizzu commented 4 years ago

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

niv-breez commented 4 years ago

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
OlegNovosad commented 4 years ago

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/'
Renathesco commented 4 years ago

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.

luco commented 4 years ago

@Renathesco Aqui tbm.

sensoft2207 commented 4 years ago

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

devangelmotta commented 4 years ago

Unfortunately I have the same error here.

krizzu commented 4 years ago

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

devangelmotta commented 4 years ago

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
tido64 commented 4 years ago

@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.

oguzhangedik commented 4 years ago

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.

rahamin1 commented 4 years ago

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

RichardLindhout commented 4 years ago

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

rahamin1 commented 4 years ago

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

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

RichardLindhout commented 4 years ago

You should def checkout this tool: https://react-native-community.github.io/upgrade-helper/

RichardLindhout commented 4 years ago

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

rahamin1 commented 4 years ago

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...