宝石不是在本地宝石包安装后

时间:2021-09-28 00:18:20

New machine. New rbenv install. New rbenv-gemset install. New ruby-2.0.0 install. New rails 4.0.0 app.

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

When I

当我

$ bundle install

from the rails app directory, I get

我从rails应用程序目录中获取

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

But, if I then

但是,如果我

$ gem list

none of the gems that were supposedly installed show up.

所有的宝石都没有被发现。

I have run

我已经运行

$ rbenv rehash

Why could this be?

为什么会是这样呢?

Additional info:

额外的信息:

$ 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 个解决方案

#1


4  

Your default in this app is to install to vendor/bundle. You can tell this by It was installed into ./vendor/bundle text which appears after gems installation.

您在这个应用程序中的默认设置是安装到供应商/bundle。您可以从它被安装到。/vendor/bundle文本中看出这一点,该文本将在gems安装之后出现。

Bundler documentation specifies that you have to pass --system to install in system location:

Bundler文档指定必须通过——系统安装在系统位置:

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

EDIT: More explanation is that your ruby knows only about gems installed with --system option when not using bundle exec. You can see your gems from vendor/bundle or whatever path you've chosen by running bundle exec gem list or (as Casper noticed) bundle list. Now it is your choice whether you want your gems in system location or in application directory.

编辑:更多的解释是您的ruby只知道如何在不使用bundle exec的情况下安装—system选项。您可以通过运行bundle exec gem列表或(如Casper注意到的)bundle列表从供应商/bundle或任何路径中看到您的gems。现在,您可以选择在系统位置还是在应用程序目录中使用gem。

#1


4  

Your default in this app is to install to vendor/bundle. You can tell this by It was installed into ./vendor/bundle text which appears after gems installation.

您在这个应用程序中的默认设置是安装到供应商/bundle。您可以从它被安装到。/vendor/bundle文本中看出这一点,该文本将在gems安装之后出现。

Bundler documentation specifies that you have to pass --system to install in system location:

Bundler文档指定必须通过——系统安装在系统位置:

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

EDIT: More explanation is that your ruby knows only about gems installed with --system option when not using bundle exec. You can see your gems from vendor/bundle or whatever path you've chosen by running bundle exec gem list or (as Casper noticed) bundle list. Now it is your choice whether you want your gems in system location or in application directory.

编辑:更多的解释是您的ruby只知道如何在不使用bundle exec的情况下安装—system选项。您可以通过运行bundle exec gem列表或(如Casper注意到的)bundle列表从供应商/bundle或任何路径中看到您的gems。现在,您可以选择在系统位置还是在应用程序目录中使用gem。