After successfully installed all of the aboves I was going to create react-native app using npx react-native init AwesomeProject comand and faced Your Ruby version is 2.6.8, but your Gemfile specified 2.7.5 error is also given in attached file. please check it and help me to suggest the way to solved.
Question posted in React native
The official React Native documentation can be found here.
The official React Native documentation can be found here.
4
Answers
It seems like you need to upgrade your machines ruby installation from 2.6.8 to 2.7.5. If you have rbenv installed you can install multiple versions of ruby onto your machine and switch between them.
rbenv install 2.7.5
I have followed these instructions to solve this issue:
Homebrew install: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
watchman install: brew install watchman
Install Ruby: followed rbenv Official Github Repo link to install the required version of ruby
Install CocoaPods: sudo gem install cocoapods
CocoaPods in fixed location: sudo gem install -n /usr/local/bin ffi cocoa pods
After the environment setup, it works perfectly.
Those users who use the MacBook air M1, Please make sure that your terminal is working on the Rosetta
Finder > Go > Utilities > Terminal > GetInfo
I attached the image for your reference.
Ruby 2.6.8 is Mac system Ruby version. So we should install Ruby 2.7.5 manually. We can install it with Chruby.
brew install ruby-install chruby
open -e ~/.zshrc
Add configuration commands for Chruby:
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
chruby ruby-2.7.5
ruby-install ruby 2.7.5
check ruby version
ruby -v
follow only 3 steps:
rvm install ruby-2.7.5
rvm –default use 2.7.5
rvm use system
now close and re-open terminal then check ruby version. hopefully this will be your expected version there.