react-native 构建失败,错误代码为 65 和 ___darwin_check_fd_set_overflow

cod*_*ons 5 macos xcode xcodebuild ios react-native

我正在尝试构建一个 React Native 应用程序。我之前已经与其他 React Native 项目合作过,并且没有遇到任何问题。这一次,我无法运行该应用程序。

我创建了一个新的 react-native 项目:

npx react-native init demoproject
Run Code Online (Sandbox Code Playgroud)

并运行它:

cd demoproject
npx react-native start
npx react-native run-ios
Run Code Online (Sandbox Code Playgroud)

在终端中,我收到此错误:

错误 无法构建 iOS 项目。我们运行了“xcodebuild”命令,但它以错误代码 65 退出。要进一步调试构建日志,请考虑使用 Xcode.app 构建您的应用程序,方法是打开 demoproject.xcworkspace。使用 --verbose 标志运行 CLI 以获取更多详细信息。

当我尝试使用 Xcode 运行它时,出现此错误:

Undefined symbols for architecture x86_64:
  "___darwin_check_fd_set_overflow", referenced from:
  _RAND_poll in libcrypto.a(rand_unix.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我尝试了这些步骤但没有成功。

react-native start --reset-cache
rm -rf node_modules/
rm -rf package-lock.json 
cd ios
pod deintegrate
cd ..
rm -rf ios/Podfile.lock 
npm install
npm audit fix
react-native link
cd ios
pod install
cd ..
react-native run-ios
Run Code Online (Sandbox Code Playgroud)

环境:

Xcode: 11.2 (11B52)
OS: mac OS Catalina 10.15.1
react-native-cli: 2.0.1
react-native: 0.62.2
Run Code Online (Sandbox Code Playgroud)

我尝试了其他一些 react-native 项目,它们运行成功。它们还运行在相同的 react-native 版本(0.62.2)上

有没有办法解决这个问题?将 Xcode 更新到另一个版本(如 11.4 或 11.6)会解决问题吗?

Cha*_*eep 6

您必须从文件中删除 Flipper Pod 转到您的项目文件夹->ios->Podfile 并从该文件中注释 Flipper,如下所示

 #use_flipper!
 #post_install do |installer|
   #flipper_post_install(installer)
 #end
Run Code Online (Sandbox Code Playgroud)

现在从 ios 文件夹在终端中输入以下命令

 pod install
Run Code Online (Sandbox Code Playgroud)

它将解决这个问题。


Mar*_*rio 2

临时解决方法:

  1. 在podfile中注释掉所有flipper函数;
  2. 删除appDelegate.m中的flipperInit;
  3. 在 ios 文件夹中运行 pod install;
  4. 洁净工程;
  5. 再次运行项目。