我刚刚安装了一个新的react native
项目v 0. 71. 1。只要光盘进入我的项目,我得到任何错误说
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.
在我使用bundle install && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install
cd到iOS目录以启用新架构后
我收到一个错误消息
[!] 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
#
# -------------------------------------------
我的ruby
版本是ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]
我试过rvm get stable --auto-dotfiles
但我仍然得到错误消息Unknown ruby interpreter version (do not know how to handle): File.readFile.join__dir__,.ruby-version.strip.
我还尝试执行rbenv install 2.7.6
,2.7.6是react-native
推荐的版本,但我收到错误消息
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
下面是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
1条答案
按热度按时间b4wnujal1#
你需要一个
.ruby-version
文件来声明ruby版本:只需在项目目录中执行:
echo "2.7.6" > .ruby-version
即可。如果文件已存在,请安装在此文件上设置的版本。
关于安装错误,请查看:Installing ruby with ruby-install causes error out on Mac M1,它似乎解决了同样的问题。