如何修复 react-native 中的“boost/operators.hpp”文件未找到”错误

xcl*_*gbo 9 boost react-native

当我使用“react-native run-ios”时,出现了一些错误,“boost/operators.hpp”文件未找到。我无法构建和运行我的项目:

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


Run Code Online (Sandbox Code Playgroud)

项目可以构建和运行。

Hil*_*nry 31

如果您在升级到react-native 0.66后在react-native-reanimated中遇到此问题,请更新您的react-native-reanimatedpackage.json

Try "react-native-reanimated": "2.3.0-beta.2" 
Run Code Online (Sandbox Code Playgroud)

不要忘记运行yarn installnpm install更新您的软件包。还执行pod installforios并重新启动您的服务器实例。

编辑:

react-native@0.66已正式添加对它的支持react-native-reanimated@2.2.3,它的错误较少,并且解决了更多问题。

另请检查github 上的问题。

  • 请注意,RN 0.66 不能很好地与重新启动的 2.3.0-beta.2 配合使用。注意到应用程序冻结时存在一些 ios 错误,但希望在您阅读本文时该问题已得到解决。https://github.com/facebook/react-native/issues/32329 (3认同)
  • 这个解决了我的问题。 (2认同)

Sta*_*Luo 6

这可能是由于 pod 安装不完整 - 尝试删除ios/Pods文件夹并pod installios.