Gems won't load

Corey's Avatar


12 May, 2010 12:55 AM

I've installed the development version of Crunchbang, a linux distro based off Debian. I got Ruby and Rubygems installed, but I can't get the gems I've installed to load. Here is a command-line session:

# ruby -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux]

# gem env
RubyGems Environment:  
  - RUBY VERSION: 1.9.1 (2010-01-10 patchlevel 378) [i486-linux]  
  - INSTALLATION DIRECTORY: /usr/lib/ruby1.9.1/gems/1.9.1  
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1  
    - ruby  
    - x86-linux  
  - GEM PATHS:  
     - /usr/lib/ruby1.9.1/gems/1.9.1  
     - /home/corey/.gem/ruby/1.9.1  
     - :update_sources => true  
     - :verbose => true  
     - :benchmark => false  
     - :backtrace => false  
     - :bulk_threshold => 1000  

# echo $PATH

# gem list -d nokogiri

`*** LOCAL GEMS ***`  

nokogiri (1.4.1)  
    Authors: Aaron Patterson, Mike Dalessio  
    Installed at: /usr/lib/ruby1.9.1/gems/1.9.1  
    Nokogiri (鋸) is an HTML, XML, SAX, and Reader parser  

# ruby -r rubygems -e "require 'nokogiri'"
-e:1:in `require': no such file to load -- nokogiri (LoadError)  
from -e:1:in `<main>'

I've encountered similar problems on Ubuntu before, but they were easy to fix. I can't figure out what's wrong in this particular case, and Google didn't seem to know either. Any help would be greatly appreciated!

  1. Support Staff 1 Posted by Nick Quaranto on 12 May, 2010 04:17 AM

    Nick Quaranto's Avatar

    That's definitely wacky.... what happens if you just launch irb and do

    require 'rubygems'
    require 'nokogiri'

    The same? Maybe show us the output of require 'pp'; pp $LOAD_PATH after requiring RubyGems too.

  2. 2 Posted by Corey on 12 May, 2010 12:11 PM

    Corey's Avatar

    In that case, the required path is absent. I'm confused. IRB doesn't read the PATH when it starts?

    irb(main):001:0> require 'rubygems' 
    => true
    irb(main):002:0> require 'nokogiri'
    LoadError: no such file to load -- nokogiri
      from (irb):2:in `require'
      from (irb):2
      from /usr/bin/irb:12:in `<main>'
    irb(main):003:0> require 'pp'
    => true
    irb(main):004:0> pp $LOAD_PATH
    => nil
  3. Support Staff 3 Posted by Eric Hodel on 12 May, 2010 06:06 PM

    Eric Hodel's Avatar

    "Based off Debian" is the problem. Ruby 1.9.1 ships with RubyGems which provides an alternative to RubyGems rubygems/custom_require.rb which Debian has removed.

    Since RubyGems expects that alternative to exist custom_require won't be loaded on 1.9.1. I'm not sure what the official Debian solution to this problem is, but installing ruby from source will fix it.

  4. Nick Quaranto closed this discussion on 17 Jul, 2010 08:30 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac