ruby-on-rails – 在`require’中:没有这样的文件可以加载 – iconv(LoadError)

前端之家收集整理的这篇文章主要介绍了ruby-on-rails – 在`require’中:没有这样的文件可以加载 – iconv(LoadError)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
  1. expertiza git:(master) ruby -v
  2. ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0]
  3. expertiza git:(master) rails -v
  4. Rails 2.3.14
  5. expertiza git:(master) script/server
  6. /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3:in `require': no such file to load -- iconv (LoadError)
  7. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3
  8. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer/inflections.rb:1:in `require'
  9. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer/inflections.rb:1
  10. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer.rb:2:in `require'
  11. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer.rb:2
  12. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8:in `require'
  13. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8
  14. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8:in `each'
  15. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8
  16. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support.rb:56:in `require'
  17. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support.rb:56
  18. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.14/lib/commands/server.rb:1:in `require'
  19. from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.14/lib/commands/server.rb:1
  20. from script/server:3:in `require'

我已经尝试安装

  1. rvm pkg install readline
  2. rvm pkg install iconv
  3. rvm install 1.8.7
  4. rvm use 1.8.7

甚至尝试了Installing nokogiri fails / libiconv missing.

没有什么工作.请帮忙!

谢谢!

解决方法

显示iconv不存在,但iconv已经安装在我的生产环境中.
  1. root@AY130/current# iconv --version
  2. iconv (Ubuntu EGLIBC 2.15-0ubuntu10.4) 2.15
  3. Copyright (C) 2012 Free Software Foundation,Inc.
  4. This is free software; see the source for copying conditions. There is NO
  5. warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  6. Written by Ulrich Drepper.

解决它,请将其添加到您的Gemfile中:

  1. gem "iconv","~> 1.0.3"

然后运行捆绑安装.

注意:iconv已被弃用一段时间.它被替换为(builtin)String#encode
见:https://bbs.archlinux.org/viewtopic.php?id=160369

猜你在找的Ruby相关文章