I just installed a new react native
project v 0.71.1. As soon as the cd into my project I get any error saying
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/transformhub/Desktop/rnapp/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
Unknown ruby interpreter version (do not know how to handle): File.readFile.join__dir__,.ruby-version.strip.
Once I cd to iOS directory to enable the new architecture using bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
I get an error saying
[!] There was an error parsing `Gemfile`: No such file or directory @ rb_sysopen - /Users/transformhub/Desktop/rnapp/.ruby-version. Bundler cannot continue.
# from /Users/transformhub/Desktop/rnapp/Gemfile:4
# -------------------------------------------
# # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
> ruby File.read(File.join(__dir__, '.ruby-version')).strip
#
# -------------------------------------------
My ruby
version is ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
I tried doing rvm get stable --auto-dotfiles
but I still get error saying Unknown ruby interpreter version (do not know how to handle): File.readFile.join__dir__,.ruby-version.strip.
I also tried doing rbenv install 2.7.6
, 2.7.6 is the version recommended by react-native
but I get error saying
readline.c:1904:37: error: use of undeclared identifier 'username_completion_function'; did you mean 'rl_username_completion_function'?
rl_username_completion_function);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
readline.c:79:42: note: expanded from macro 'rl_username_completion_function'
# define rl_username_completion_function username_completion_function
^
/opt/homebrew/opt/readline/include/readline/readline.h:494:14: note: 'rl_username_completion_function' declared here
extern char *rl_username_completion_function (const char *, int);
^
1 error generated.
make[2]: *** [readline.o] Error 1
Below is the output of echo $PATH
/Users/transformhub/.rbenv/shims:/Users/transformhub/.rbenv/shims:/Users/transformhub/.rbenv/bin:/Users/transformhub/.rbenv/shims:/opt/homebrew/opt/ruby/bin:/Users/transformhub/.gem/bin:/Users/transformhub/.pyenv/shims:/Users/transformhub/.pyenv/bin:/Users/transformhub/.pyenv/bin:/Users/transformhub/.rbenv/shims:/Users/transformhub/.rbenv/bin:/Library/Frameworks/Python.framework/Versions/3.9/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/transformhub/Desktop/flutter/bin :/usr/local/go/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Postgres.app/Contents/Versions/latest/bin:/Users/transformhub/Library/Android/sdk/platform-tools:/Users/transformhub/Users/transformhub/Desktop/flutter/bin:/Users/transformhub/Android/Sdk/tools:/Users/transformhub/Android/Sdk/tools/bin:/Users/transformhub/Android/Sdk/platform-tools:/Library/Frameworks/Python.framework/Versions/3.9/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/Users/transformhub/Desktop/flutter/bin:/Users/transformhub/.cargo/bin:/Users/transformhub/.rvm/bin
2
Answers
You need a file
.ruby-version
that states the ruby version:simply do:
echo "2.7.6" > .ruby-version
in the project directory.If the file already exists install the version set on this file.
Regarding the installation error please take a look at: Installing ruby with ruby-install causes error out on Mac M1 which seems to address the same problem.
For me same error during Ruby installation was solved with