react-native: Your Ruby version is 2.6.8, but your Gemfile specified 2.7.6 error while enabling new architecture on react-native iOS
Description
I have already gone through this post
I am facing this issue on my new react-native project version 0.71.1 while enabling the new architecture for iOS
I have done all the below steps
$ brew update
$ brew install ruby-build
$ brew install rbenv
$ rbenv install 2.7.6
$ rbenv global 2.7.6
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(rbenv init -)"' >> ~/.zshrc
When I run ruby --version
I get ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin22]
which is the correct ruby version required to enable new architecture on iOS
but when I run bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
I still get error saying
Your Ruby version is 2.6.10, but your Gemfile specified 2.7.6
Version
0.71.1
Output of npx react-native info
error Unrecognized command “info”. info Run “react-native --help” to see a list of all available commands.
Steps to reproduce
Install a new react-native project version 0.71.1, go to the iOS directory and run bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
Snack, code example, screenshot, or link to a repository
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 3
- Comments: 23 (7 by maintainers)
I use Apple silicon M1 and this work for me
Install RVM
I restart and run npx react-native@latest init ProjectName at Installing Bundler will ask to install CocoaPods I choose Yes, with gem (may require sudo )
and finish create ReactNative Project
sorry I’m not good in English
@BraveEvidence @Rache-lBronfman I’m sorry for this. We are updating React Native so that it won’t enforce any specific versions of Ruby anymore.
Meanwhile, we suggest to:
rbenv
rbenv install 2.7.6
project/ios
folderrbenv local 2.7.6
to set the Ruby version for your projectbundle install
bundle exec pod intall
Let me know if this works.
These aren’t the easiest things to track down, but I’m guessing since this exact report is in many places - you might be feeling that pain. Or you missed something extremely easy like not restarting the terminal after injecting items to the zsh profile.
What I think you should do is go through this https://github.com/facebook/react-native/issues/35873#issuecomment-1408079446 post again, but do the investigation - not just get to the end result for a specific user and test that. Since you really want to see what your
$PATH
is during that execution. See if you have a different binary fighting for priority.This outside of a bug in CLI is normally a mixed up PATH and trading priorities of things. If we look at your initial post - I don’t see this line in the install guide, nor did we do it when configuring rbenv. So why is this here? rbenv init sets up everything as described here - https://github.com/rbenv/rbenv#how-rbenv-hooks-into-your-shell
What I’ll say is I find that
gem install bundler
proxies correctly with rbenv and sets it up forbundle install
to properly operate. I can’t say that is your problem though because I can’t see your path.