我正在尝试对旧项目进行一些更新,并面临支持新 iOS 版本更新带来的常见问题。运行一些 npm 更新和 React Native 升级后,我能够成功安装 pod,但现在当我运行 ios 时,它无法构建并出现以下错误:
The following build commands failed:
PhaseScriptExecution [CP-User]\ [RN]Check\ rncore .../Build/Intermediates.noindex/Pods.build/Debug-iphonesimulator/React-Fabric.build/Script-EC9C377125AD0589400F123D2D4CB2D3.sh (in target 'React-Fabric' from project 'Pods')
这是我的反应本机信息:
info Fetching system and libraries information...
System:
OS: macOS 14.5
CPU: (8) arm64 Apple M3
Memory: 82.38 MB / 16.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 20.16.0
path: ~/.nvm/versions/node/v20.16.0/bin/node
Yarn: Not Found
npm:
version: 10.8.1
path: ~/.nvm/versions/node/v20.16.0/bin/npm
Watchman:
version: 2024.07.29.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.15.2
path: /opt/homebrew/lib/ruby/gems/3.3.0/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 23.5
- iOS 17.5
- macOS 14.5
- tvOS 17.5
- visionOS 1.2
- watchOS 10.5
Android SDK: Not Found
IDEs:
Android Studio: 2024.1 AI-241.18034.62.2411.12071903
Xcode:
version: 15.4/15F31d
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.12
path: /usr/bin/javac
Ruby:
version: 3.3.4
path: /opt/homebrew/opt/ruby/bin/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.74.5
wanted: 0.74.5
react-native-macos: Not Found
npmGlobalPackages:
"*react-native*": Not Found
Android:
hermesEnabled: false
newArchEnabled: false
iOS:
hermesEnabled: false
newArchEnabled: false
我有什么想法可以开始解决这个问题吗?
深入挖掘后,这是失败的构建文件:
echo "Checking whether Codegen has run..."
rncorePath="$REACT_NATIVE_PATH/ReactCommon/react/renderer/components/rncore"
if [[ ! -d "$rncorePath" ]]; then
echo 'error: Codegen did not run properly in your project. Please reinstall cocoapods with `bundle exec pod install`.'
exit 1
fi
因此,由于某种原因,
$REACT_NATIVE_PATH/ReactCommon/react/renderer/components/rncore
路径不存在。我不确定为什么,我会继续研究。
由于某些 Pod 尝试使用低于我的 Podfile 中指定的最低支持版本,代码生成器似乎无法正常工作。我不确定为什么会这样,但我遇到了一个 github 问题,修复方法如下。
https://github.com/travis-mark/lrn/commit/015854716feadd61a904d5a603b027426472f863
该修复是一个安装后脚本,它使用 Podfile 中的最低 ios 版本覆盖 IPHONEOS_DEPLOYMENT_TARGET。
构建正在运行