React Native 0.73 iOS环境搭建:Boost 1.83.0安装校验失败求助
React Native 0.73 iOS
pod install 时 Boost 1.83.0 安装失败问题 问题描述
搭建React Native 0.73版本项目时,在iOS目录执行pod install遇到Boost 1.83.0安装失败,核心错误为校验和不匹配:
[!] Error installing boost
Verification checksum was incorrect, expected 6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e, got 5e89103d9b70bba5c91a794126b169cb67654be2051f90cf7c22ba6893ede0ff
完整错误日志:
(node:66063) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead. (Use `node --trace-deprecation ...` to show where the warning was created) Framework build type is static library [Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json [Codegen] generating an empty RCTThirdPartyFabricComponentsProvider Analyzing dependencies Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec` [Codegen] Found FBReactNativeSpec Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec` [Codegen] Found rncore Fetching podspec for `boost` from `../node_modules/react-native/third-party-podspecs/boost.podspec` Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec` Fetching podspec for `hermes-engine` from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec` [Hermes] Using release tarball from URL: https://repo1.maven.org/maven2/com/facebook/react/react-native-artifacts/0.73.1/react-native-artifacts-0.73.1-hermes-ios-debug.tar.gz Downloading dependencies Installing CocoaAsyncSocket (7.6.5) Installing DoubleConversion (1.1.6) Installing FBLazyVector (0.73.1) Installing FBReactNativeSpec (0.73.1) Installing Flipper (0.201.0) Installing Flipper-Boost-iOSX (1.76.0.1.11) Installing Flipper-DoubleConversion (3.2.0.1) Installing Flipper-Fmt (7.1.7) Installing Flipper-Folly (2.6.10) Installing Flipper-Glog (0.5.0.5) Installing Flipper-PeerTalk (0.0.4) Installing FlipperKit (0.201.0) Installing OpenSSL-Universal (1.1.1100) Installing RCT-Folly (2022.05.16.00) Installing RCTRequired (0.73.1) Installing RCTTypeSafety (0.73.1) Installing React (0.73.1) Installing React-Codegen (0.73.1) Installing React-Core (0.73.1) Installing React-CoreModules (0.73.1) Installing React-Fabric (0.73.1) Installing React-FabricImage (0.73.1) Installing React-ImageManager (0.73.1) Installing React-Mapbuffer (0.73.1) Installing React-NativeModulesApple (0.73.1) Installing React-RCTActionSheet (0.73.1) Installing React-RCTAnimation (0.73.1) Installing React-RCTAppDelegate (0.73.1) Installing React-RCTBlob (0.73.1) Installing React-RCTFabric (0.73.1) Installing React-RCTImage (0.73.1) Installing React-RCTLinking (0.73.1) Installing React-RCTNetwork (0.73.1) Installing React-RCTSettings (0.73.1) Installing React-RCTText (0.73.1) Installing React-RCTVibration (0.73.1) Installing React-callinvoker (0.73.1) Installing React-cxxreact (0.73.1) Installing React-debug (0.73.1) Installing React-graphics (0.73.1) Installing React-hermes (0.73.1) Installing React-jserrorhandler (0.73.1) Installing React-jsi (0.73.1) Installing React-jsiexecutor (0.73.1) Installing React-jsinspector (0.73.1) Installing React-logger (0.73.1) Installing React-nativeconfig (0.73.1) Installing React-perflogger (0.73.1) Installing React-rendererdebug (0.73.1) Installing React-rncore (0.73.1) Installing React-runtimeexecutor (0.73.1) Installing React-runtimescheduler (0.73.1) Installing React-utils (0.73.1) Installing ReactCommon (0.73.1) Installing SocketRocket (0.6.1) Installing Yoga (1.14.0) Installing boost (1.83.0) [!] Error installing boost Verification checksum was incorrect, expected 6478edfe2f3305127cffe8caf73ea0176c53769f4bf1585be237eb30798c3b8e, got 5e89103d9b70bba5c91a794126b169cb67654be2051f90cf7c22ba6893ede0ff
环境信息
- Xcode Command Line tools: Xcode 14.3.1
- Node.js: 21.5.0
- macOS: Ventura 13.5
已尝试针对M1芯片的React Native搭建教程(如《How to fix “pod install” error in React Native on Mac M1》),问题未解决。
解决方案
1. 清理CocoaPods缓存
缓存的Boost包可能损坏,先删除相关缓存:
# 删除指定版本的Boost缓存 rm -rf ~/Library/Caches/CocoaPods/Pods/Release/boost/1.83.0 # 可选:清理所有Pods缓存 rm -rf ~/Library/Caches/CocoaPods
清理后重新执行pod install。
2. 修改Boost校验和(临时方案)
如果清理缓存后仍报错,直接修改react-native自带的podspec文件:
- 打开
node_modules/react-native/third-party-podspecs/boost.podspec - 找到校验和配置项,将预期值替换为实际得到的
5e89103d9b70bba5c91a794126b169cb67654be2051f90cf7c22ba6893ede0ff - 保存文件后重新执行
pod install
3. 切换React Native小版本
0.73.1的Boost依赖可能存在校验问题,尝试切换到同分支的其他版本:
# 降级到0.73.0 npm install react-native@0.73.0 --save # 或升级到0.73.2 npm install react-native@0.73.2 --save
执行后删除node_modules、ios/Podfile.lock和ios/Pods目录,再重新执行pod install。
4. 使用本地Boost包
下载官方Boost 1.83.0预编译包,放到项目本地并修改podspec指向:
- 下载Boost 1.83.0 iOS包
- 在项目根目录创建
third-party文件夹,放入下载的Boost包 - 修改
node_modules/react-native/third-party-podspecs/boost.podspec,将s.source指向本地路径,并注释掉校验和相关配置
内容的提问来源于stack exchange,提问作者user492046
相关产品推荐
相关产品推荐

