react-native-fs: Installing from Podfile fails
Might be related to #258. Adding RNFS using cocoapods leads to build failure.
I’ll try to be as thorough as possible–
From my package.json
, you can see that I’m using:
"react": "16.0.0-alpha.12",
"react-native": "0.45.1",
"react-native-fs": "^2.3.3",
The following is my Podfile:
target 'myapp' do
pod 'RNFS', :path => '../node_modules/react-native-fs'
end
While building, I get the following errors from the react-native CLI:
/Applications/MAMP/htdocs/myapp/node_modules/react-native-fs/RNFSManager.m:17:9: fatal error: 'React/RCTImageLoader.h' file not found
#import <React/RCTImageLoader.h>
^
1 error generated.
** BUILD FAILED **
The following build commands failed:
CompileC /Applications/MAMP/htdocs/myapp/ios/build/Build/Intermediates/Pods.build/Debug-iphonesimulator/RNFS.build/Objects-normal/x86_64/RNFSManager.o /Applications/MAMP/htdocs/myapp/node_modules/react-native-fs/RNFSManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(1 failure)
This results in the following error represented in the simulator:
This results in the following error represented in Xcode:
Things I’ve tried:
- I’ve cleaned the build
- killed/restarted package manager
- cleaned out and reinstalled NPM
- removed all other pods to ensure that this is isolated to RNFS
I’m wondering if this has to do with the Cocoapod’s dependency on an outdated version of React?
I noticed the following while running pod install
:
Analyzing dependencies
Fetching podspec for `RNFS` from `../node_modules/react-native-fs`
Downloading dependencies
Installing RNFS (2.3.3)
Installing React (0.11.0)
Generating Pods project
Integrating client project
Sending stats
Pod installation complete! There is 1 dependency from the Podfile and 2 total pods installed.
Any help is appreciated.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 24 (7 by maintainers)
The original problem of the topic seems to be caused by the fact that subspec
RCTImage
ofreact-native
is not installed. @colewinans can you share yourPodfile
andPodfile.lock
?You can also try fixing this by having this in your
Podfile
:I’ve managed to get everything working by doing a combination of stuff mentioned in the thread.
first i did the
pod deintegrate
second i manually updated my Podfile to include this
and lastly i did
pod install
.everything was fine after that. But notice i had to add the ‘yoga’ lib in pods as well since React/Core depends on it.
Hope this helps anyone in the future.
My problem is solved by adding this line pod ‘React’, :path => ‘…/node_modules/react-native’, :subspecs => [ ‘RCTImage’, ] then pod install react-native link. Now some other issue is there that says ‘linker command failed’ but that seem to be a total different issue
Thanks
2.9.11 same issue.
For me it seems like a wrong and outdated version of React-Lib will be installed thru Pods. Can someone confirm?
2.11.15 same issue!!
I had this same issue, and after experimenting a bit, adding this to my Podfile is what made it all work for me:
Note that I did not run
pod deintegrate
.