Pod安装在React Native和Mac M2上失败,出现在glog。

huangapple go评论77阅读模式
英文:

Pod installation fails at glog with React Native and Mac M2

问题

我的问题

我两周前购买了我的 MacBook Pro M2,从那以后,我无法在我的 React Native 应用中安装 Pods。(之前在 M1 上使用 React Native 工作了一年都没有问题)。

当我运行命令 cd ios && pod install 时,错误总是在到达 glog pod 时发生。

我的目标

我想运行 npm run ios(就像我以前在我的旧电脑上做的那样)并在 iOS 模拟器中安装/运行应用程序。

我尝试过的

在过去的2-3周里,我一直在安装和重新安装从Node、Ruby、Bundler、Xcode、Command Line Tools等所有内容... 我尝试了来自GitHub和Stack Overflow的所有解决方案,但都没有对我起作用,我真的感到很绝望,似乎没有什么能够起作用。

引发错误的命令

cd ios && pod install

错误(摘要)

-> 正在安装 boost (1.76.0)
   > 从 `/Users/jvegax/Library/Caches/CocoaPods/Pods/External/boost/909665deed38b6f25051fac8c534aa3c-57d28` 复制到 `Pods/boost`

-> 正在安装 fmt (6.2.1)
   > 从 `/Users/jvegax/Library/Caches/CocoaPods/Pods/Release/fmt/6.2.1-ff9d5` 复制到 `Pods/fmt`

-> 正在安装 glog (0.3.5)
   > Git 下载
   > Git 下载
       $ /opt/homebrew/bin/git clone https://github.com/google/glog.git
       /var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7 --template= --single-branch --depth 1
       --branch v0.3.5
   正在克隆到 '/var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7'...
   注意: 正在切换到 'a6a166db069520dbbd653c97c2e5b12e08a8bb26'。

   您处于 '分离头部' 状态。您可以四处查看,进行实验性更改和提交,可以在此状态下制作的任何提交都不会影响任何分支,并且可以通过执行另一个检出命令来放弃在此状态下进行的任何提交。

   如果您想创建一个新分支以保留您创建的提交,可以使用检出命令并使用 -c。例如:

   git switch -c <新分支名称>

   或者通过以下方式撤消操作:

   git switch -

   通过将 advice.detachedHead 配置变量设置为 false 来关闭此建议。
   
[!] 安装 glog 时出错
  CDN: 版本路径: CocoaPods-version.yml 已存在!返回本地,因为仅在仓库更新时才进行检查

React Native 信息

系统:
  操作系统: macOS 13.4.1
  CPU: (8) arm64 Apple M2
  内存: 95.67 MB / 8.00 GB
  Shell:
    版本: "5.9"
    路径: /bin/zsh
二进制文件:
  Node:
    版本: 18.16.1
    路径: /usr/local/bin/node
  Yarn:
    版本: 1.22.19
    路径: /opt/homebrew/bin/yarn
  npm:
    版本: 9.6.7
    路径: /opt/homebrew/bin/npm
  Watchman:
    版本: 2023.06.26.00
    路径: /opt/homebrew/bin/watchman
管理器:
  CocoaPods:
    版本: 1.12.1
    路径: /Users/jvegax/.rbenv/shims/pod
SDK:
  iOS SDK:
    平台:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: 未找到
IDE:
  Android Studio: 2022.2 AI-222.4459.24.2221.10121639
  Xcode:
    版本: 14.3.1/14E300c
    路径: /usr/bin/xcodebuild
语言:
  Java:
    版本: 11.0.19
    路径: /usr/bin/javac
  Ruby:
    版本: 2.7.6
    路径: /Users/jvegax/.rbenv/shims/ruby
npm 包:
  "@react-native-community/cli": 未找到
  react: 未找到
  react-native: 未找到
  react-native-macos: 未找到
npm 全局包:
  "*react-native*": 未找到
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: 未找到
  newArchEnabled: 未找到

~/.zprofile

eval "$(\/opt\/homebrew\/bin\/brew shellenv)"

export ANDROID_SDK_ROOT="/Users/jvegax/Library/Android/sdk"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK_ROOT/platform-tools"
export ANDROID_TOOLS="$ANDROID_SDK_ROOT/tools"
export ANDROID_TOOLS_BIN="$ANDROID_TOOLS/bin"
export ANDROID_BUILD_TOOLS="$ANDROID_SDK_ROOT/build-tools/33.0.0" # 根据 SDK 版本进行编辑

path=(
  $ANDROID_TOOLS
  $ANDROID_SDK_ROOT
  $ANDROID_TOOLS_BIN
  $ANDROID_PLATFORM_TOOLS
  $ANDROID_BUILD_TOOLS
  $path
)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # 这会加载 nvm
[ -s "$NVM

<details>
<summary>英文:</summary>

**My problem**

I bought my MacBook Pro M2 two weeks ago, and since then, I&#39;ve been unable to install the pods in my React Native app. (I&#39;ve been working with React Native for over a year without issues on an M1).

The error starts when I run the command `cd ios &amp;&amp; pod install`, I always get an error when it reaches the **glog pod**.

**My goal**

I want to run `npm run ios` (like I always did with my previous mac) and install/run the app in the iOS simulator.


**What I&#39;ve tried** 

During the last 2-3 weeks, I&#39;ve been installing &amp; re-installing everything from Node, Ruby, Bundler, Xcode, Command Line Tools... I&#39;ve tried everything from the github and stack overflow issues, but none of the worked for me and I&#39;m really desperate that nothing seems to work.

**Command that throws error**

`cd ios &amp;&amp; pod install`


**Error** (summarized)

-> Installing boost (1.76.0)
> Copying boost from
/Users/jvegax/Library/Caches/CocoaPods/Pods/External/boost/909665deed38b6f25051fac8c534aa3c-57d28 to Pods/boost

-> Installing fmt (6.2.1)
> Copying fmt from /Users/jvegax/Library/Caches/CocoaPods/Pods/Release/fmt/6.2.1-ff9d5 to Pods/fmt

-> Installing glog (0.3.5)
> Git download
> Git download
$ /opt/homebrew/bin/git clone https://github.com/google/glog.git
/var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7 --template= --single-branch --depth 1
--branch v0.3.5
Cloning into '/var/folders/tn/v1qdr5nj7g75l5fj9qzx9px80000gn/T/d20230702-30759-hefom7'...
Note: switching to 'a6a166db069520dbbd653c97c2e5b12e08a8bb26'.

You are in a 'detached HEAD' state. You can look around, make experimental changes and commits, and you can discard any commits you make in this state without impacting any branch by performing another checkout.

If you want to create a new branch to retain commits you create, you can do so (now or later) with the checkout command using -c. For example:

git switch -c <new-branch-name>

Or undo the operation with:

git switch -

Turn off this advice by setting the advice.detachedHead configuration variable to false.

[!] Error installing glog
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only performed in repo update




**React Native Info**

System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M2
Memory: 95.67 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 18.16.1
path: /usr/local/bin/node
Yarn:
version: 1.22.19
path: /opt/homebrew/bin/yarn
npm:
version: 9.6.7
path: /opt/homebrew/bin/npm
Watchman:
version: 2023.06.26.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/jvegax/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.4
- iOS 16.4
- macOS 13.3
- tvOS 16.4
- watchOS 9.4
Android SDK: Not Found
IDEs:
Android Studio: 2022.2 AI-222.4459.24.2221.10121639
Xcode:
version: 14.3.1/14E300c
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.19
path: /usr/bin/javac
Ruby:
version: 2.7.6
path: /Users/jvegax/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found


**~/.zprofile**

eval "$(/opt/homebrew/bin/brew shellenv)"

export ANDROID_SDK_ROOT="/Users/jvegax/Library/Android/sdk"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK_ROOT/platform-tools"
export ANDROID_TOOLS="$ANDROID_SDK_ROOT/tools"
export ANDROID_TOOLS_BIN="$ANDROID_TOOLS/bin"
export ANDROID_BUILD_TOOLS="$ANDROID_SDK_ROOT/build-tools/33.0.0" #edit according to sdk version

path=(
$ANDROID_TOOLS
$ANDROID_SDK_ROOT
$ANDROID_TOOLS_BIN
$ANDROID_PLATFORM_TOOLS
$ANDROID_BUILD_TOOLS
$path
)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
eval "$(rbenv init -)"



**~/.zshrc**

eval "$(/opt/homebrew/bin/brew shellenv)"

Path to your oh-my-zsh installation.

export ZSH="$HOME/.oh-my-zsh"

ZSH_THEME="gozilla"

source $ZSH/oh-my-zsh.sh

export ANDROID_SDK_ROOT="/Users/jvegax/Library/Android/sdk"
export ANDROID_PLATFORM_TOOLS="$ANDROID_SDK_ROOT/platform-tools"
export ANDROID_TOOLS="$ANDROID_SDK_ROOT/tools"
export ANDROID_TOOLS_BIN="$ANDROID_TOOLS/bin"
export ANDROID_BUILD_TOOLS="$ANDROID_SDK_ROOT/build-tools/33.0.0" #edit according to sdk version

path=(
$ANDROID_TOOLS
$ANDROID_SDK_ROOT
$ANDROID_TOOLS_BIN
$ANDROID_PLATFORM_TOOLS
$ANDROID_BUILD_TOOLS
$path
)

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && . "$NVM_DIR/bash_completion" # This loads nvm bash_completion
eval "$(rbenv init -)"


</details>


# 答案1
**得分**: 1

也许你已经尝试过这个了,但你尝试过删除 podfile.lock 文件以删除旧的依赖项,然后重新安装所有内容吗?

pod deintegrate
pod setup
pod install


<details>
<summary>英文:</summary>

Perhaps you have already tried this but have you tried deleting podfile.lock to delete old pods and and reinstall everything doing 

pod deintegrate
pod setup
pod install

</details>



huangapple
  • 本文由 发表于 2023年7月3日 02:26:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/76600257.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定