Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix 'boost/operators.hpp' file not found' error in react-native

when I use 'react-native run-ios', there is some error, 'boost/operators.hpp' file not found. I can not build and run my project:

react-native-cli: 2.0.1 react-native: 0.59.9 npm: 6.9.0 yarn: 1.16.0 node: v12.4.0 os: macos 10.14.5 xcode: 10.2.1

▸ Compiling JSIDynamic.cpp

❌  /Users/lidongbo/WorkBentch/ReactNative/AwesomeProject/node_modules/react-native/React/../third-party/folly-2018.10.22.00/folly/dynamic.h:63:10: 'boost/operators.hpp' file not found

#include <boost/operators.hpp>
              ^


▸ Analyzing JSCRuntime.cpp
▸ Analyzing jsi.cpp
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 AwesomeProject.xcodeproj


project can build and run.

like image 287
xclidongbo Avatar asked Jun 15 '19 22:06

xclidongbo


3 Answers

If you get this issue in react-native-reanimated after upgrading to react-native 0.66 update your react-native-reanimated in package.json

Try "react-native-reanimated": "2.3.0-beta.2" 

Don't forget to run yarn install or npm install to update your packages. Also do a pod install for ios and restart your server instance .

EDIT:

Support for [email protected] has been officially added by [email protected] It is less buggy and a lot more issues have been solved.

Also check issue on github.

like image 193
Hillkim Henry Avatar answered Oct 22 '22 16:10

Hillkim Henry


This might due to incomplete pods install - try deleting ios/Pods folder and run pod install under ios.

like image 28
Stanley Luo Avatar answered Oct 22 '22 17:10

Stanley Luo


An alternative error for the same issue that I encountered was:

ios/Pods/boost-for-react-native/boost/operators.hpp:97:10: 'boost/config.hpp' file not found

To fix it, you need to clear cocoa pods and cache and re-install.

  1. Delete cocoa pods cache: rm -r ~/Library/Caches/CocoaPods
  2. Delete the Pods folder and the Podfile.lock usually located in <project_root>/ios.
  3. Reinstall pods: pod update
like image 4
Gabriel Bull Avatar answered Oct 22 '22 17:10

Gabriel Bull