# Console/Server fetching different gems

**URL:** <https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642>\
**Category:** Rails\
**Created:** [November 8, 2009, 9:14pm UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642 "2009-11-08T21:14:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 8, 2009, 9:14pm UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/1 "2009-11-08T21:14:19Z")

</div>

Hey All,

I’m running into a situation where ruby script/server and ruby  
script/console are apparently not pulling gems from the same directory.  
Ex:

$\> ruby script/console

> > require ‘nokogiri’  
> > =\> []  
> > Nokogiri  
> > =\>Nokogiri

When I do it with script/server I get the following behaviour

> $ ruby script/server  
> =\> Booting WEBrick  
> =\> Rails 2.3.2 application starting on [http://0.0.0.0:3000](http://0.0.0.0:3000)  
> Ruby/Extensions: Array#rand is already defined; not overwriting  
> Ruby/Extensions: Binding#eval is already defined; not overwriting  
> Ruby/Extensions: Enumerable#none? is already defined; not overwriting  
> Ruby/Extensions: Enumerable#one? is already defined; not overwriting  
> Ruby/Extensions: Integer#even? is already defined; not overwriting  
> Ruby/Extensions: Integer#odd? is already defined; not overwriting  
> Ruby/Extensions: String#starts\_with? is already defined; not overwriting  
> Ruby/Extensions: String#ends\_with? is already defined; not overwriting  
> Ruby/Extensions: Symbol#to\_proc is already defined; not overwriting  
> =\> Call with -d to detach  
> =\> Ctrl-C to shutdown server  
> [2009-11-08 15:13:55] INFO WEBrick 1.3.1  
> [2009-11-08 15:13:55] INFO ruby 1.8.7 (2009-06-12) [i686-darwin10.0.0]  
> [2009-11-08 15:13:55] INFO WEBrick::HTTPServer#start: pid=96403  
> port=3000  
> nil  
> SQL (0.2ms) SET NAMES ‘utf8’  
> SQL (0.1ms) SET SQL\_AUTO\_IS\_NULL=0

Processing FeedController#create (for 127.0.0.1 at 2009-11-08 15:14:00)  
[POST]  
Parameters: {“commit”=\>“Add”,  
“authenticity\_token”=\>“fpXtb6uJPmunPMS8hUKisGIXdeTxM+Odefrtzxlvq8o=”,  
“feed”=\>{“feed\_url”=\>"[Quality Health is momentarily down...](http://www.qualityhealth.com/rss-feeds/all-content.xml)  
"}}  
Cached fragment hit:  
views/localhost:3000/homepage/homepage?left\_navigation=top\_feeds (0.2ms)  
Cached fragment hit:  
views/localhost:3000/homepage/homepage?left\_navigation=top\_categories  
(0.2ms)  
Cached fragment hit:  
views/localhost:3000/homepage/homepage?left\_navigation=top\_media (0.2ms)  
Feed Columns (1.5ms) SHOW FIELDS FROM `feeds`

MissingSourceFile (no such file to load – nokogiri):  
lib/sax-machine/sax\_document.rb:1  
lib/sax-machine.rb:5  
lib/feedzirra.rb:7  
app/models/feed.rb:50:in `update_feed' app/controllers/feed_controller.rb:16:in `create’  
/usr/local/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/local/lib/ruby/1.8/webrick/httpserver.rb:65:in `run’  
/usr/local/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/local/lib/ruby/1.8/webrick/server.rb:95:in `start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/local/lib/ruby/1.8/webrick/server.rb:92:in `start’  
/usr/local/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/local/lib/ruby/1.8/webrick/server.rb:82:in `start’

Rendered rescues/\_trace (110.2ms)  
Rendered rescues/\_request\_and\_response (3.0ms)  
Rendering rescues/layout (internal\_server\_error)

Firstly, am I correct to assume that I should not be seeing different  
behavior with each environment?

Any idea why this would be happening? I assume that my server is  
misconfigured in some way. What should I be looking for?

Thanks,  
Jim

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 9, 2009, 7:03am UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/2 "2009-11-09T07:03:08Z")

</div>

Hi James E.

Have you configured gem in config/environment.rb using  
config.gem and also require ‘nokogiri’ where you use it?

Sijo

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 9, 2009, 3:30pm UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/3 "2009-11-09T15:30:41Z")

</div>

On Nov 9, 1:03 am, Sijo k g [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi James E.
> 
> Have you configured gem in config/environment.rb using  
> config.gem and also require ‘nokogiri’ where you use it?

Note that you shouldn’t need the require - config.gem does that  
automatically.

–Matt J.

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 11, 2009, 5:04am UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/4 "2009-11-11T05:04:10Z")

</div>

Yeah. I’ve tried both requiring the file and using the config.gem. I  
didn’t  
have much luck either way.

On Mon, Nov 9, 2009 at 1:03 AM, Sijo k g

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 11, 2009, 5:05am UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/5 "2009-11-11T05:05:55Z")

</div>

Yeah. The #! line is the same in both cases. It’s the stragest thing.  
I’m  
starting to believe I might have my rubygems pointing to two different  
system gem locations (well, three including the non-root version). Is  
there  
a command that you can run in ruby to determine where rubygems is  
pulling  
the gems?

---

<div class="post-metadata">

**Author:** ![chero](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/e99b99/32.png) [@chero](https://www.ruby-forum.com/u/chero)\
**Post date:** [November 9, 2009, 3:34pm UTC](https://www.ruby-forum.com/t/console-server-fetching-different-gems/178642/6 "2009-11-09T15:34:12Z")

</div>

On Nov 8, 3:12 pm, James E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hey All,
> 
> I’m running into a situation where ruby script/server and ruby  
> script/console are apparently not pulling gems from the same directory. Ex:

[snip]

> Firstly, am I correct to assume that I should not be seeing different  
> behavior with each environment?
> 
> Any idea why this would be happening? I assume that my server is  
> misconfigured in some way. What should I be looking for?
> 
> Thanks,  
> Jim

Do script/console and script/server have the same #! line? I remember  
that Perl would “helpfully” run whatever interpreter was in there  
(even if it wasn’t Perl!), and Ruby may have inherited similar  
behavior.

–Matt J.
