我在通过rbenv管理的VM(VirtualBox)中安装了MailCatcher。
但是,mailcatcher不起作用,在下面显示错误消息:
`require': cannot load such file -- i18n/core_ext/string/interpolate (LoadError)
似乎没有安装i18n,但我已经安装了它。
[vagrant@localhost ~]$ gem list i18n
*** LOCAL GEMS ***
i18n (0.7.0.beta1)
我以同样的方式安装在AWS EC2中,它可以正常工作。
我的VM中会发生什么?
- - 细节 - -
作业系统:CentOS 6.5
Ruby:2.1.1和rbenv 0.4.0
完整的错误消息:
[vagrant@localhost ~]$ mailcatcher--http-ip 192.168.33.12
/home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- i18n/core_ext/string/interpolate (LoadError)
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-3.2.19/lib/active_support/core_ext/string/interpolation.rb:2:in `<top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-3.2.19/lib/active_support/core_ext/string.rb:9:in `<top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-3.2.19/lib/active_support/core_ext.rb:2:in `block in <top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-3.2.19/lib/active_support/core_ext.rb:1:in `each'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/activesupport-3.2.19/lib/active_support/core_ext.rb:1:in `<top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/mailcatcher-0.5.12/lib/mail_catcher.rb:1:in `<top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/vagrant/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/mailcatcher-0.5.12/bin/mailcatcher:3:in `<top (required)>'
from /home/vagrant/.rbenv/versions/2.1.1/bin/mailcatcher:23:in `load'
from /home/vagrant/.rbenv/versions/2.1.1/bin/mailcatcher:23:in `<main>'
最佳答案
rails 4.2 beta/activesupport-4.2.0.beta2取决于i18n( = 0.7.0.beta1)。
如果mailcatcher(0.5.12)加载了i18n的beta版gem,则会引发错误。
如果您不使用Rails 4.2 Beta,则可以卸载Beta版本
gem uninstall i18n -v i18n-0.7.0.beta1
在gem的多个问题中都提到了这一点
https://github.com/sj26/mailcatcher/issues/164
https://github.com/sj26/mailcatcher/issues/155
关于ruby - MailCatcher不适用于VM上的rbenv,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/25486365/