rails gem' countries' - LoadError:无法加载此类文件 - iso3166

时间:2016-03-11 15:07:35

标签: ruby-on-rails ruby rubygems

我使用gem 'countries', require: 'iso3166'

当我尝试启动服务器时出现此错误:

rake aborted!

LoadError: cannot load such file -- iso3166
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
/home/davide/Desktop/app/koodos/config/application.rb:14:in `<top (required)>'
/home/davide/Desktop/app/koodos/Rakefile:4:in `require'
/home/davide/Desktop/app/koodos/Rakefile:4:in `<top (required)>'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/bin/ruby_executable_hooks:15:in `eval'
/home/davide/.rvm/gems/ruby-2.1.5@ekoodo/bin/ruby_executable_hooks:15:in `<main>'
(See full trace by running task with --trace)

我尝试再次运行bundle install,但它没有帮助。我在网上搜索了类似的问题,但我找不到任何解决方案。

有关可能导致错误的原因的任何想法?

2 个答案:

答案 0 :(得分:1)

在你的gemfile中添加它并再次捆绑

gem 'countries', :require => 'countries/global'

iso3166模块已添加到gem本身。

您可以看到文档https://github.com/hexorx/countries

答案 1 :(得分:0)

国家1.2.0及以上版本要求与之前不同的包含。由于您被锁定在1.2.5,请使用新的要求。

gem 'countries', :require => 'countries/global'

如果仍有问题,请运行bundle install