RVM不会在Mac上更改Ruby版本

时间:2018-01-16 18:15:13

标签: ruby-on-rails ruby macos rvm macos-sierra

我试图在Mac上更改我的红宝石版本,即使它在正确的红宝石版本(2.3.4)上说它仍然无法正常工作。

示例输出:

:~ my_username$ cd my_project_name
:my_project_name my_username$ which ruby
/Users/my_username/.rvm/rubies/ruby-2.3.4/bin/ruby
:my_project_name my_username$ ruby -v
ruby 2.3.4p301 (2017-03-30 revision 58214) [x86_64-darwin16]
:my_project_name my_username$ bundle install
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.3.2 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.3.2
Your Ruby version is 2.5.0, but your Gemfile specified 2.3.4
:my_project_name my_username$

和RVM列表,然后尝试为我的项目捆绑安装:

:my_project_name my_username$ rvm list

rvm rubies

=* ruby-2.3.4 [ x86_64 ]
   ruby-2.4.0 [ x86_64 ]
   ruby-2.4.1 [ x86_64 ]
   ruby-2.4.2 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

:my_project_name my_username$ bundle install
Ignoring executable-hooks-1.3.2 because its extensions are not built. Try: gem pristine executable-hooks --version 1.3.2
Ignoring gem-wrappers-1.3.2 because its extensions are not built. Try: gem pristine gem-wrappers --version 1.3.2
Your Ruby version is 2.5.0, but your Gemfile specified 2.3.4
:my_project_name my_username$

正如您所看到的,我安装了2.3.4并设置为当前的ruby版本,但它在我的目录中没有检测到它。我已经在一个新的终端窗口关闭并重试了几次。

1 个答案:

答案 0 :(得分:1)

看起来我在安装RVM之前安装了捆绑器。跑gem install bundler,现在我可以捆绑安装,一切正常。