执行pod install时react-native-config报alwaysOutOfDate选项未识别错误
解决
pod install时react-native-config的验证错误 执行pod install命令时遇到如下错误:
The
react-native-configpod failed to validate due to 1 error:
- ERROR | script_phases: Unrecognized option(s)alwaysOutOfDatein script phaseConfig codegen.
Available options arename, script, shell_path, input_files, output_files, input_file_lists, output_file_lists, show_env_vars_in_log, execution_position, dependency_file.
环境信息:
- Xcode
14.0 - react-native 0.67.1
- react-native-config
1.4.6
解决方案
以下三种方法任选其一即可:
- 升级CocoaPods版本
alwaysOutOfDate是CocoaPods较新版本才支持的配置项,当前环境的CocoaPods版本不兼容这个参数。执行以下命令升级到最新稳定版:
sudo gem install cocoapods
升级完成后重新执行pod install。
修改react-native-config的podspec文件
找到项目中node_modules/react-native-config/react-native-config.podspec文件,定位到Config codegen对应的脚本阶段配置,删除其中的:alwaysOutOfDate => true行,保存后重新执行pod install。升级react-native-config版本
更新到该库的最新版本,新版本通常会修复这类兼容性问题:
# npm 用户 npm install react-native-config@latest --save # yarn 用户 yarn add react-native-config@latest
更新完成后重新执行pod install。
内容的提问来源于stack exchange,提问作者QuentinNpApnl
相关产品推荐
相关产品推荐

