如何修复集成unimodules时pod install无法安装Pods依赖的问题
错误原因
Podfile本质是Ruby格式文件,你的文件存在两处语法错误,触发了本次报错:
use_react_native!(:path => config["reactNativePath"]行末尾缺少闭合的右括号)pod 'ReactNativeART', :path => '../node_modules/@react-native-community/art',行末尾多了多余的逗号,
报错指向第20行是Ruby逐行解析的特性导致的:前面的语法问题直到解析到use_unimodules!行时才触发校验失败,实际错误位置在更靠前的行。
修复方案
将Podfile内容替换为以下修复后的版本:
require_relative '../node_modules/react-native/scripts/react_native_pods' require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules' require_relative '../node_modules/react-native-unimodules/cocoapods.rb' platform :ios, '13.0' $FirebaseSDKVersion = '7.7.0' target 'Instadating' do # Uncomment the next line if you're using Swift or would like to use dynamic frameworks # use_frameworks! config = use_native_modules! use_react_native!(:path => config["reactNativePath"]) pod 'ReactNativeART', :path => '../node_modules/@react-native-community/art' use_unimodules! end
验证步骤
- 保存修改后的Podfile
- 执行
pod deintegrate清理旧的Pods残留配置 - 执行
pod install即可正常完成依赖安装
内容的提问来源于stack exchange,提问作者Xwingoga06
相关产品推荐
相关产品推荐

