捆绑软件安装后,宝石不在本地宝石中 [英] Gems not in Local Gems after bundle install
问题描述
新机器.新安装了rbenv.新安装了rbenv-gemset.新安装的ruby-2.0.0.新的Rails 4.0.0应用程序.
New machine. New rbenv install. New rbenv-gemset install. New ruby-2.0.0 install. New rails 4.0.0 app.
当我
$ bundle install
从Rails应用程序目录中,我得到
from the rails app directory, I get
Your bundle is complete!
It was installed into ./vendor/bundle
但是,如果我那么
$ gem list
据说没有安装的宝石都没有出现.
none of the gems that were supposedly installed show up.
我跑了
$ 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
推荐答案
您在此应用中的默认设置是安装到vendor/bundle
.您可以通过安装gems后出现的It was installed into ./vendor/bundle
文字来说明这一点.
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.
捆绑程序文档指定您必须通过--system
才能在系统位置安装:
Bundler documentation specifies that you have to pass --system
to install in system location:
--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
时,您的红宝石只知道使用--system选项安装的宝石.您可以从vendor/bundle
或运行bundle exec gem list
或(如Casper注意到的)bundle list
选择的任何路径中查看宝石.现在,您是要在系统位置还是在应用程序目录中放置宝石.
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.
这篇关于捆绑软件安装后,宝石不在本地宝石中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!