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

➜  expertiza git:(master) ✗ ruby -v
    ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0]
    ➜  expertiza git:(master) ✗ rails -v
    Rails 2.3.14
    ➜  expertiza git:(master) ✗ script/server
/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)
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/inflector.rb:3
    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'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer/inflections.rb:1
    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'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext/integer.rb:2
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8:in `require'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8:in `each'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support/core_ext.rb:8
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support.rb:56:in `require'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/activesupport-2.3.14/lib/active_support.rb:56
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.14/lib/commands/server.rb:1:in `require'
    from /Users/HPV/.rvm/gems/ruby-1.8.7-p352/gems/rails-2.3.14/lib/commands/server.rb:1
    from script/server:3:in `require'

我已经尝试安装

rvm pkg install readline
rvm pkg install iconv
rvm install 1.8.7
rvm use 1.8.7

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

没有什么工作.请帮忙!

谢谢!

解决方法

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

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

gem "iconv","~> 1.0.3"

然后运行捆绑安装.

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

相关文章

validates:conclusion,:presence=>true,:inclusion=>{...
一、redis集群搭建redis3.0以前,提供了Sentinel工具来监控各...
分享一下我老师大神的人工智能教程。零基础!通俗易懂!风趣...
上一篇博文 ruby传参之引用类型 里边定义了一个方法名 mo...
一编程与编程语言 什么是编程语言? 能够被计算机所识别的表...
Ruby类和对象Ruby是一种完美的面向对象编程语言。面向对象编...