找不到ruby rbenv gem

时间:2015-08-21 11:15:42

标签: ruby bundler rbenv

在我的项目中我

require 'log4r'

但运行ruby app.rb

时收到以下错误消息
/Users/mattw/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- log4r (LoadError)
from /Users/mattw/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/mattw/projects/placetel/config/initializers.rb:1:in `<top (required)>'
from /Users/mattw/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/mattw/.rbenv/versions/2.1.3/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from app.rb:1:in `<main>' 

如果我bundle show它会给我:

Gems included by the bundle:
* bundler (1.10.6)
* curb (0.8.1)
* log4r (1.1.10)
* nori (1.1.3)

我使用rbenv 0.4.0和bundler 1.10.6

在本地运行ruby 2.1.3

1 个答案:

答案 0 :(得分:0)

确保使用

初始化bundler
#t01, #t01 td {
    width: 300px;
    font-size: 80%;
    border: 0;
}
#t02, #t02 th, #t02 td {
    border: 1px solid black;
    border-collapse: collapse;
    width: 300px;
    font-size: 80%;
}

有关http://bundler.io/v1.10/bundler_setup.html

设置的更多信息