Closed alex-mironov closed 5 years ago
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:
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 <RNCAsyncStorage/RNCAsyncStorageDelegate.h>
^~~~~~~~~~~
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.
TO
@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
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:
pod repo update
or with pod install --repo-update
.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
target 'project name' do
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
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:
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
Current behavior
After adding Async Storage build fails with
fatal error: 'React/RCTBridgeModule.h' file not found
.Environment