You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native iOS执行pod install时找不到RNPermissions依赖的问题

解决React Native iOS pod install时RNPermissions依赖缺失问题

问题重现

执行以下命令时触发报错:

$ cd ios
$ pod install

报错核心内容:

!Unable to find a specification for `RNPermissions` depended upon by `Permission-LocationAlways`

You have either:
-mistyped the name or version.
-not added the source repo that hosts the Podspec to your Podfile.

解决方案

针对同环境其他机器可正常执行、仅本地报错的情况,按以下步骤排查:

  1. 清理CocoaPods本地缓存
    本地缓存可能存在损坏或过期的spec文件,执行命令彻底清理:

    pod cache clean --all
    

    也可以手动删除缓存目录:

    rm -rf ~/.cocoapods/repos
    
  2. 更新CocoaPods仓库
    确保本地spec仓库与远程同步:

    pod repo update
    
  3. 确认依赖包与Podfile配置

    • 先确认react-native-permissions已正确安装到项目:
      npm install react-native-permissions
      
    • 打开iOS目录下的Podfile,确保添加了正确的官方源:
      source 'https://cdn.cocoapods.org/'
      
    • 若自动链接未生效,手动添加RNPermissions的路径引用(适配React Native 0.63版本):
      pod 'RNPermissions', :path => '../node_modules/react-native-permissions'
      
  4. 重置项目Pod依赖文件
    进入iOS目录,删除残留的Pod配置文件后重新安装:

    cd ios
    rm -rf Pods Podfile.lock
    pod install
    
  5. 验证Xcode命令行工具版本
    确保Xcode命令行工具与当前使用的Xcode版本匹配:

    xcode-select --print-path
    

    若路径不正确,切换到正确的Xcode目录:

    xcode-select --switch /Applications/Xcode.app/Contents/Developer
    

内容的提问来源于stack exchange,提问作者manoj chandola

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.28 12:03:24