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

React Native新项目执行pod install报错,求问题排查与解决

解决React Native pod install时的权限错误

问题描述

在新React Native项目中使用bundler执行pod install时遇到如下错误:

warn Multiple Podfiles were found: ios/Podfile,vendor/bundle/ruby/2.7.0/gems/cocoapods-core-1.11.3/lib/cocoapods-core/Podfile. Choosing ios/Podfile automatically. If you would like to select a different one, you can configure it via "project.ios.sourceDir".
[Codegen] Generating ./build/generated/ios/React-Codegen.podspec.json
fatal: not a git repository (or any of the parent directories): .git
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
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/hermes-engine.podspec
[!] Couldn't determine repo type for URL: https://cdn.cocoapods.org/: Permission bits for '/Users/macbook/.netrc' should be 0600, but are 644

解决步骤

  • 修复核心权限问题
    错误根源是~/.netrc文件权限不符合CocoaPods的安全要求,执行以下命令修改权限:
    chmod 0600 ~/.netrc
    
  • (可选)消除git警告
    日志中的git仓库警告不影响pod安装,若要移除该提示,在项目根目录执行:
    git init
    
  • 重新执行安装
    再次运行bundler命令完成pod安装:
    bundle exec pod install
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.16 22:35:23