如何获取捆绑程序以使用chruby和.ruby-version设置的Ruby版本? [英] How can I get bundler to use the Ruby version set by chruby and .ruby-version?
问题描述
我很高兴为运行Ruby 1.8.7的应用程序设置开发环境。不幸的是 bundler
没有使用 chruby <
.ruby-version
中设置的Ruby版本。 / code>。
I have the pleasure of setting up a development environment for an application running Ruby 1.8.7. Unfortunately bundler
is not using the version of Ruby set in .ruby-version
by chruby
.
此外,我的红宝石 1.8.7
c $ c> Gemfile
Also, I have ruby "1.8.7"
included in the Gemfile
本地版本为 ruby-1.8.7-p374
, bundler
环境正在使用 ruby-2.5.0p0
。
Whereas the local version is ruby-1.8.7-p374
, the bundler
environment is using ruby-2.5.0p0
.
$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin17.3.0]
$ bundle env | grep Ruby
Ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-darwin17]
这将导致以下消息:
$ bundler
Your Ruby version is 2.5.0, but your Gemfile specified 1.8.7
此问题包含一些有用的评论,但到目前为止,我还无法解决该问题。我确实通过<$安装了 vim
在 / usr / local / opt
中安装了Ruby 2.5.0。 c $ c>酿造vim 。这将在Ruby 1.8.7捆绑脚本使用的版本中出现,例如:
This issue contains some helpful comments but so far I haven't been able to resolve the issue. I do have Ruby 2.5.0 installed in /usr/local/opt
as a result of installing vim
via brew install vim
. This would appear to the version that the Ruby 1.8.7 bundle script is using, as evidenced by:
$ which bundle
/Users/keithpitty/.gem/ruby/1.8.7/bin/bundle
$ head -n1 $(which bundle)
#!/usr/local/opt/ruby/bin/ruby
事实证明,这个问题令人非常沮丧。
This problem is proving to be quite frustrating. I would very much appreciate any suggestions.
推荐答案
我通过安装RubyGems 1.6.2修复了此问题。请参阅如何在gem环境中设置正确的Ruby版本(更多)。
I fixed this by installing RubyGems 1.6.2. See How to set correct Ruby version in gem environment for more.
这篇关于如何获取捆绑程序以使用chruby和.ruby-version设置的Ruby版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!