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:

screen shot 2017-06-26 at 4 05 25 pm

This results in the following error represented in Xcode:

screen shot 2017-06-26 at 4 08 10 pm

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)

Most upvoted comments

The original problem of the topic seems to be caused by the fact that subspec RCTImage of react-native is not installed. @colewinans can you share your Podfile and Podfile.lock?

You can also try fixing this by having this in your Podfile:

    pod 'React', :path => '../node_modules/react-native', :subspecs => [
        // other subspecs you may already have here 
        'RCTImage',
    ]

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

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

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:

pod 'React', :path => '../node_modules/react-native', :subspecs => [
  'Core',
  'CxxBridge',
  'DevSupport',
  'RCTActionSheet',
  'RCTAnimation',
  'RCTBlob',
  'RCTCameraRoll',
  'RCTImage',
  'RCTNetwork',
  'RCTPushNotification',
  'RCTSettings',
  'RCTText',
  'RCTVibration',
  'RCTWebSocket',
  'RCTLinkingIOS'
]

# Explicitly include Yoga if you are using RN >= 0.42.0
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'

Note that I did not run pod deintegrate.