iOS 빌드시 undefined method `exists?' for File:Class. 에러 발생

에러

Invalid "RNGestureHandler.podspec` file: undefined method `exists?' for File:Class.

원인

터미널에서 ruby -v 해봐서 ruby 버전이 2 이어서 발생한 경우

해결방법

Ruby 3.1.3 설치

brew install chruby
brew install ruby-install

ruby-install ruby 3.1.3

~/.zshrc 파일에 chruby를 이용해서 루비 버전 지정

아래 내용을 ~/.zshrc 에 추가합니다.

source /opt/homebrew/opt/chruby/share/chruby/chruby.sh
source /opt/homebrew/opt/chruby/share/chruby/auto.sh
chruby ruby-3.1.3

(필요한 경우) cocoapods 설치

gem install cocoapods

관련 이슈