В `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
Даже попробовал Почему установка Nokogiri на Mac OS не выполняется с libiconv отсутствует?.
Ничего не работает. Пожалуйста, помогите!
Спасибо!
Ответы
Ответ 1
Это показывает, что iconv не существует, но iconv установлен в моей версии env.
[email protected]/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"
Затем запустите bundle install
.
Примечание. iconv устарел некоторое время. Он заменяется (встроенным) символом String # encode
См. Здесь: https://bbs.archlinux.org/viewtopic.php?id=160369
Ответ 2
Для тех, кто использует rbenv вместо rvm
$ which iconv
$ /usr/local/bin/iconv
Затем используйте расположение каталога iconv для переустановки ruby
$ CONFIGURE_OPTS="--with-iconv-dir=/usr/local" rbenv install 1.8.7-p358
Удачи.
(Как примечание, эта ошибка, как сообщается, произошла в Ruby 1.8.7-p3xx)