捆绑安装后,Gems不在Local Gems中

时间:2013-07-06 11:12:15

标签: ruby-on-rails ruby bundler rbenv rbenv-gemset

新机器。新的rbenv安装。新的rbenv-gemset安装。新的ruby-2.0.0安装。新的rails 4.0.0 app。

当我

$ bundle install

从rails app目录,我得到了

Your bundle is complete!
It was installed into ./vendor/bundle

但是,如果我那么

$ gem list

所有安装的宝石都没有显示出来。

我跑了

$ rbenv rehash

为什么会这样?

其他信息:

$ which bundle
/usr/local/var/rbenv/shims/bundle
$ rbenv which bundle
/usr/local/var/rbenv/versions/2.0.0-p247/bin/bundle
$ rbenv which ruby
/usr/local/var/rbenv/versions/2.0.0-p247/bin/ruby
$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [x86_64-darwin12.4.0]
$ rbenv gemset active
blog
$ which rails
/usr/local/var/rbenv/shims/rails

1 个答案:

答案 0 :(得分:4)

此应用中的默认设置是安装到vendor/bundle。你可以通过宝石安装后出现的It was installed into ./vendor/bundle文字告诉你。

Bundler documentation指定您必须将--system传递到系统位置安装:

--system: Install to the system location ($BUNDLE_PATH or $GEM_HOME) even
          if the bundle was previously installed somewhere else for this
          application

编辑:更多解释是,在不使用bundle exec时,您的ruby只知道使用--system选项安装的gem。您可以通过vendor/bundle或(如Casper注意到的)bundle exec gem listbundle list或您选择的任何路径中查看您的宝石。现在,您可以选择是将系列位置还是应用程序目录中的宝石。