EAS ios Build Fail: folly/Optional.h' file not found

Hello I have created a managed project on Expo. I tired to build my app using EAS

eas build -p ios --profile development

Build i get a build failed error


❌  (ios/Pods/Headers/Public/ReactCommon/ReactCommon/TurboModuleUtils.h:13:10)

  11 | #include <string>
  12 | 
> 13 | #include <folly/Optional.h>
     |          ^ 'folly/Optional.h' file not found
  14 | #include <jsi/jsi.h>
  15 | 
  16 | #include <ReactCommon/CallInvoker.h>
› Compiling react-native-vision-camera Pods/VisionCamera » JSIUtils.mm

❌  (ios/Pods/Headers/Public/ReactCommon/ReactCommon/TurboModuleUtils.h:13:10)

  11 | #include <string>
  12 | 
> 13 | #include <folly/Optional.h>
     |          ^ 'folly/Optional.h' file not found
  14 | #include <jsi/jsi.h>
  15 | 
  16 | #include <ReactCommon/CallInvoker.h>

Here’s my eas.json

{
  "build": {
    "release": {},
    "development": {
      "developmentClient": true,
      "distribution": "internal"
    }
  }
}

Any one faced similar issues or could it be something i’m doing wrong ?

looks like the issue with react-native-vision-camera, most likely that package assumes different version of react-native that expo managed workflow provides

1 Like

Hi @worisor445 (Cc. @wkozyra)

This comment from RN Vision Camera issue #195 looks like it might be the answer:

mrousavy commented on 26 Jul

So as far as I know, Expo 43 will come with React Native 0.64, which fixes all those build issues.
I think I will not merge your change @matheusmatos, so that VisionCamera only works on Expo 43 and above, just for the sake of simplicity (the VisionCamera.podspec would be very messy and users are required to edit their Podfile which is bad DX).
As for non-expo users, most of them are already on RN 0.64 anyways.
Thank you for providing a workaround people can use until then, as well as for your detailed research.

If you need it before Expo SDK 43 then you could in theory check Matheus Matos’s comment in that issue for changes to be made to RN Vision Camera (VisionCamera.podspec and ios/React Utils/JSIUtils.mm) and apply those changes using patch-package.

Based on past Expo SDK releases I suspect Expo SDK 43 should be released within the next couple of weeks.

Hi @wodin

Thanks for your response. but I’m still kinda stuck here. Your solution requires that I run

expo prebuild

to compile the mods and generate the /iOS folder . However this also requires that I’m running on a MacOS. but I’m working with a windows machine which is the reason why I chose to subscribe to the EAS priority plan in the first place.

the version of react-native used in your project does not support react-native-vision-camera. you can wait until sdk 43 is released with a new version of react-native, or you can try using an older version of react-native-vision-camera.

Hi @wkozyra

Thanks for your response.

What is a possible solution to this?. They made provision to integrate with expo in their documentation which mean clearly it works with the current version of Expo and the RN it supports.

No. expo prebuild is run automatically on Expo’s build servers when you run eas build.

EDIT: Sorry, I see where the confusion comes in. The ios/React Utils/JSIUtils.mm mentioned in my previous comment is part of React Native Vision Camera. Not the ios directory in the top level of your app if you run expo prebuild.

i.e. the full paths are:

node_modules/react-native-vision-camera/VisionCamera.podspec
node_modules/react-native-vision-camera/ios/React Utils/JSIUtils.mm

So the idea is you modify those files as per Matheus’ comment and then use patch-package so that this modification also gets applied on Expo’s build servers during the build.

Then when Expo SDK 43 is released you can get rid of the patch.

I think they must have updated something since the config plugin was created. They say themselves that it would be best to wait for Expo SDK 43. But perhaps you could try an older release of react-native-vision-camera as Brent mentioned.