no such file to load — sanitize (LoadError)

a 夏天 提交于 2019-12-11 11:32:44

问题


(Working in Ubuntu and using ruby, rails, and gems.)

I installed the sanitize gem (version 2.0.3).

When requiring it from the code, an error is occurring:

`require': no such file to load -- sanitize (LoadError)

I know the gem is installed: gem list | grep sanitize returns sanitize (2.0.3)

which gem

returns

/usr/bin/gem

and

which ruby

returns

/usr/bin/ruby

So to check which gem is installed

ls -l /usr/bin/gem*

returns

lrwxrwxrwx 1 root root  15 2011-12-06 18:37 /usr/bin/gem -> /usr/bin/gem1.8
-rwxr-xr-x 1 root root 545 2011-09-16 16:19 /usr/bin/gem1.8

And to check which ruby version is installed

ls -l /usr/bin/ruby*

returns

lrwxrwxrwx 1 root root   16 2011-12-06 18:38 /usr/bin/ruby -> /usr/bin/ruby1.8
-rwxr-xr-x 1 root root 6264 2010-03-19 17:52 /usr/bin/ruby1.8

Finally,

gem env 

returns

RubyGems Environment:
  - RUBYGEMS VERSION: 1.6.2
  - RUBY VERSION: 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux]
  - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8
  - RUBY EXECUTABLE: /usr/bin/ruby1.8
  - EXECUTABLE DIRECTORY: /usr/bin
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - /usr/lib/ruby/gems/1.8
     - /root/.gem/ruby/1.8
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :benchmark => false
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - http://rubygems.org/

I read elsewhere on stackoverflow that this can be solved by symbolic links. I also read about using the config/environment.rb file, but I prefer to fix it with symbolic links.

Any idea which links I have to create or change?

UPDATE: require 'nokogiri' is also return the no such file to load error. I have nokogiri (1.5.0) installed.

Thanks

来源:https://stackoverflow.com/questions/8405189/no-such-file-to-load-sanitize-loaderror

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!