# Problem with require 'gemname'

**URL:** <https://www.ruby-forum.com/t/problem-with-require-gemname/187683>\
**Category:** Ruby\
**Created:** [April 27, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683 "2010-04-27T19:24:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 7:24pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/1 "2010-04-27T19:24:15Z")

</div>

Howdy folks,

Requiring gems doesn’t work unless I use gem ‘gemname’ before require  
‘gemname’. Any idea why?

Here is an example:

# gem list

\*\*\* LOCAL GEMS \*\*\*

abstract (1.0.0)  
.  
.  
.  
nokogiri (1.4.1)  
.  
.  
.

# irb

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`’  
irb(main):003:0\> gem ‘nokogiri’  
=\> true  
irb(main):004:0\> require ‘nokogiri’  
=\> true

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 7:27pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/2 "2010-04-27T19:27:51Z")

</div>

Keith C. wrote:

> Howdy folks,
> 
> Requiring gems doesn’t work unless I use gem ‘gemname’ before require  
> ‘gemname’. Any idea why?

any recent upgrades? which version of gems/ruby?  
-rp

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 7:34pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/3 "2010-04-27T19:34:42Z")

</div>

Keith C. wrote:

> Ruby 1.9.1 and gems 1.3.6.

Hmm works ok for me. Make sure that $: includes  
…/nokogiri-version/lib and it should work.  
Sorry I can’t be of more help.  
-rp

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 7:29pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/4 "2010-04-27T19:29:54Z")

</div>

Ruby 1.9.1 and gems 1.3.6.

Maybe I need to change the gem paths somehow? Looks like it is pointing  
to the right place though, see the ls below.

# gem env

RubyGems Environment:

- RUBYGEMS VERSION: 1.3.6
- RUBY VERSION: 1.9.1 (2009-07-16 patchlevel 243) [x86\_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby1.9.1/gems/1.9.1
- RUBY EXECUTABLE: /usr/bin/ruby1.9.1
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
  - ruby
  - x86\_64-linux

- GEM PATHS:
  - /usr/lib/ruby1.9.1/gems/1.9.1
  - /root/.gem/ruby/1.9.1

- GEM CONFIGURATION:
  - :update\_sources =\> true
  - :verbose =\> true
  - :benchmark =\> false
  - :backtrace =\> false
  - :bulk\_threshold =\> 1000

- REMOTE SOURCES:
  - [http://rubygems.org/](http://rubygems.org/)

# ls /usr/lib/ruby1.9.1/gems/1.9.1/gems/

abstract-1.0.0 activesupport-2.3.5 nokogiri-1.4.1  
rails-3.0.0.beta3  
actionmailer-2.3.5 activesupport-3.0.0.beta3 pg-0.9.0  
railties-3.0.0.beta3  
actionmailer-3.0.0.beta3 arel-0.3.3 polyglot-0.3.1  
rake-0.8.7  
actionpack-2.3.5 builder-2.1.2  
postgres-0.7.9.2008.01.28 text-format-1.0.0  
actionpack-3.0.0.beta3 bundler-0.9.24 postgres-pr-0.6.3  
text-hyphen-1.0.0  
activemodel-3.0.0.beta3 erubis-2.6.5 rack-1.0.1  
thor-0.13.4  
activerecord-2.3.5 i18n-0.3.7 rack-1.1.0  
treetop-1.4.5  
activerecord-3.0.0.beta3 mail-2.2.0 rack-mount-0.6.3  
tzinfo-0.3.20  
activeresource-2.3.5 memcache-client-1.8.2 rack-test-0.5.3  
activeresource-3.0.0.beta3 mime-types-1.16 rails-2.3.5

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 7:48pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/5 "2010-04-27T19:48:35Z")

</div>

Roger P. wrote:

> Make sure that $: includes  
> …/nokogiri-version/lib and it should work.

I’m not sure what that means, but none of the gems work, it’s not just  
nokogiri.

---

<div class="post-metadata">

**Author:** ![keith](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/f05b48/32.png) [@keith](https://www.ruby-forum.com/u/keith)\
**Post date:** [April 27, 2010, 9:07pm UTC](https://www.ruby-forum.com/t/problem-with-require-gemname/187683/6 "2010-04-27T21:07:41Z")

</div>

Keith C. wrote:

> Roger P. wrote:
> 
> > Make sure that $: includes  
> > …/nokogiri-version/lib and it should work.
> 
> I’m not sure what that means, but none of the gems work, it’s not just  
> nokogiri.

doing

> > p $:

should include the lib dirs mentioned.
