我最近从rvm切换到rbenv进行Ruby版本管理,因为我遇到了各种各样的宝石问题。如果我运行gem list
它只列出大约10个宝石,所有宝石都是系统默认值。但是当我在一个带有Gemfile的项目中运行bundle install
时,它列出了大量其他宝石,并表示它们已成功安装。然后我无法从命令行运行它们或在ruby文件中要求它们!
gem list
的输出:
*** LOCAL GEMS ***
bigdecimal (1.2.0)
io-console (0.4.2)
json (1.7.7)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
rubygems-update (2.3.0)
test-unit (2.0.0.0)
然后从bundle install
Using i18n 0.6.9
Using json 1.8.1
Using minitest 5.3.5
Using thread_safe 0.3.4
Using tzinfo 1.2.1
Using activesupport 4.1.1
Using builder 3.2.2
Using activemodel 4.1.1
Using arel 5.0.1.20140414130214
Using activerecord 4.1.1
Using bond 0.5.1
Using rack 1.5.2
Using rack-protection 1.5.3
Using rack-test 0.6.2
Using ripl 0.7.1
Using ripl-multi_line 0.3.1
Using ripl-rack 0.2.1
Using shotgun 0.9
Using tilt 1.4.1
Using sinatra 1.4.5
Using sinatra-activerecord 2.0.2
Using sqlite3 1.3.9
Using tux 0.3.0
Using bundler 1.6.3
Your bundle is complete!
我的gem env
如下:
RubyGems Environment:
- RUBYGEMS VERSION: 2.3.0
- RUBY VERSION: 2.0.0 (2014-05-08 patchlevel 481) [x86_64-darwin13.2.0]
- INSTALLATION DIRECTORY: /usr/local/var/rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /usr/local/var/rbenv/versions/2.0.0-p481/bin/ruby
- EXECUTABLE DIRECTORY: /usr/local/var/rbenv/versions/2.0.0-p481/bin
- SPEC CACHE DIRECTORY: /Users/Alex/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /usr/local/var/rbenv/versions/2.0.0-p481/etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-13
- GEM PATHS:
- /usr/local/var/rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0
- /Users/Alex/.gem/ruby/2.0.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--no-rdoc --no-ri"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/var/rbenv/versions/2.0.0-p481/bin
- /Users/Alex/.rbenv/libexec
- /Users/Alex/.rbenv/bin
- /usr/local/heroku/bin
- /usr/local/var/rbenv/shims
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /usr/local/bin
- /Users/Alex/.dotfiles/bin
列出的宝石路径包含我在运行gem list
时看到的10个左右的宝石。但我知道我还有其他宝石,因为捆绑商说有一吨安装成功。我认为他们在我宝石路径之外的某个地方,但我不知道在哪里。
我该怎么办?我不知道这些宝石的安装位置。我不愿意开始添加我的gem_path路径,因为这不是必需的。有没有办法告诉捆绑者强制重新安装宝石,所以他们被迫进入INSTALLATION DIRECTORY
中列出的gem env
?
我在运行Mavericks的Mac上,并且使用自制软件安装了rbenv。