Gems LoadError in Linux

A

Augusto Esteves

Hello,

I'm new to Ruby and I wanna run a test a simple Gem in the latest
Ubuntu. I've downloaded Ruby 1.9.1 and RubyGems, and the Gem I wanna
test is NFC - which appears installed as a Local Gem after I did $ sudo
gem install nfc..

The problem happens when I try to run my test code:

require 'nfc'

loop do
NFC.instance.find do |tag|
p tag
end
end

Which errors with:
`require': no such file to load -- nfc (LoadError)

After reading about Gems for a while, I found out that I also need to
add
require 'rubygems' to the beginning of the code, but that also gives me
an error:

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

What am I doing wrong? :/ Any help will be great.
 
A

Aaron Patterson

Hello,

I'm new to Ruby and I wanna run a test a simple Gem in the latest
Ubuntu. I've downloaded Ruby 1.9.1 and RubyGems, and the Gem I wanna
test is NFC - which appears installed as a Local Gem after I did $ sudo
gem install nfc..

What OS are you running on? Also, can you provide the output of:

ruby -v
gem -v

Also the output of 'gem list nfc' might be helpful.
The problem happens when I try to run my test code:

require 'nfc'

loop do
NFC.instance.find do |tag|
p tag
end
end

Which errors with:
`require': no such file to load -- nfc (LoadError)

After reading about Gems for a while, I found out that I also need to
add
require 'rubygems' to the beginning of the code, but that also gives me
an error:

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

What am I doing wrong? :/ Any help will be great.

Not sure. This is strange. You *should* be requiring rubygems at the
top of your program. But you *shouldn't* be getting that error. :)

Hopefully the info you provide us with the output of the above commands
will help us track this down!
 
R

Roger Pack

`require': no such file to load -- rubygems (LoadError)
What am I doing wrong? :/ Any help will be great.

Did you install rubygems into the same ruby that you are using to run
that file?

you could do a
$ gem which nfc

to see if the file is there, too.

You could also try installing the rubygem *without* sudo so that it is
installed to a different location that gems might like more [?]
-r
 
A

Augusto Esteves

Roger said:
Did you install rubygems into the same ruby that you are using to run
that file?

How do I know that? I did:

1. $ sudo apt-get install ruby1.9.1-full
2. $ sudo apt-get install rubygems1.9.1
you could do a
$ gem which nfc

to see if the file is there, too.

that instruction resulted in:

(checking gem nfc-2.0.1 for nfc)
/var/lib/gems/1.9.1/gems/nfc-2.0.1/lib/nfc.rb
 
A

Augusto Esteves

Got it working. I was using Ubuntu and I had version 1.8 installed
already. I was installing the gems in ruby1.8 and using ruby1.9
 
J

Jaime Gonzalez

Hi, i know that the post is old, but i'm having the same problem, i am running Ubuntu 10.04 and installed

ruby1.9.1-full
rubygems1.9.1

when requiring active record for example:

require 'rubygems'
require 'active_record'

and run the file i get error:
`require': no such file to load -- active_record (LoadError)

I dont have any other versions of ruby, just 1.9.1, any ideas?

Thanks in advanced

Jaime
Hello,

I am new to Ruby and I wanna run a test a simple Gem in the latest
Ubuntu. I have downloaded Ruby 1.9.1 and RubyGems, and the Gem I wanna
test is NFC - which appears installed as a Local Gem after I did $ sudo
gem install nfc..

The problem happens when I try to run my test code:

require 'nfc'

loop do
NFC.instance.find do |tag|
p tag
end
end

Which errors with:
`require': no such file to load -- nfc (LoadError)

After reading about Gems for a while, I found out that I also need to
add
require 'rubygems' to the beginning of the code, but that also gives me
an error:

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

What am I doing wrong? :/ Any help will be great.
--
Posted via http://www.ruby-forum.com/.
ruby -v
gem -v

Also the output of 'gem list nfc' might be helpful.


Not sure. This is strange. You *should* be requiring rubygems at the
top of your program. But you *should not* be getting that error. :)

Hopefully the info you provide us with the output of the above commands
will help us track this down!
On Wednesday, December 23, 2009 1:35 PM Roger Pack wrote:
Did you install rubygems into the same ruby that you are using to run
that file?

you could do a
$ gem which nfc

to see if the file is there, too.

You could also try installing the rubygem *without* sudo so that it is
installed to a different location that gems might like more [?]
-r
 
R

Roger Pack

Jaime said:
Hi, i know that the post is old, but i'm having the same problem, i am
running Ubuntu 10.04 and installed

ruby1.9.1-full
rubygems1.9.1

when requiring active record for example:

require 'rubygems'
require 'active_record'

Recommend trying 1.9.2 or trying it in irb like
$ ruby --disable-gems -S irb
 
E

Ernie Rojas

[Note: parts of this message were removed to make it a legal post.]

perhaps, if you try with export GEM_HOME="path_gems" ?

2010/8/20 Jaime Gonzalez said:
Hi, i know that the post is old, but i'm having the same problem, i am
running Ubuntu 10.04 and installed

ruby1.9.1-full
rubygems1.9.1

when requiring active record for example:

require 'rubygems'
require 'active_record'

and run the file i get error:
`require': no such file to load -- active_record (LoadError)

I dont have any other versions of ruby, just 1.9.1, any ideas?

Thanks in advanced

Jaime
Hello,

I am new to Ruby and I wanna run a test a simple Gem in the latest
Ubuntu. I have downloaded Ruby 1.9.1 and RubyGems, and the Gem I wanna
test is NFC - which appears installed as a Local Gem after I did $ sudo
gem install nfc..

The problem happens when I try to run my test code:

require 'nfc'

loop do
NFC.instance.find do |tag|
p tag
end
end

Which errors with:
`require': no such file to load -- nfc (LoadError)

After reading about Gems for a while, I found out that I also need to
add
require 'rubygems' to the beginning of the code, but that also gives me
an error:

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

What am I doing wrong? :/ Any help will be great.
--
Posted via http://www.ruby-forum.com/.
ruby -v
gem -v

Also the output of 'gem list nfc' might be helpful.


Not sure. This is strange. You *should* be requiring rubygems at the
top of your program. But you *should not* be getting that error. :)

Hopefully the info you provide us with the output of the above commands
will help us track this down!
On Wednesday, December 23, 2009 1:35 PM Roger Pack wrote:
Did you install rubygems into the same ruby that you are using to run
that file?

you could do a
$ gem which nfc

to see if the file is there, too.

You could also try installing the rubygem *without* sudo so that it is
installed to a different location that gems might like more [?]
-r
How do I know that? I did:

1. $ sudo apt-get install ruby1.9.1-full
2. $ sudo apt-get install rubygems1.9.1


that instruction resulted in:

(checking gem nfc-2.0.1 for nfc)
/var/lib/gems/1.9.1/gems/nfc-2.0.1/lib/nfc.rb
On Thursday, December 24, 2009 7:29 AM Augusto Esteves wrote:
Got it working. I was using Ubuntu and I had version 1.8 installed
already. I was installing the gems in ruby1.8 and using ruby1.9
Submitted via EggHeadCafe - Software Developer Portal of Choice
Changing WCF Service Implementation at Runtime
http://www.eggheadcafe.com/tutorial...ng-wcf-service-implementation-at-runtime.aspx


--
Ernie Rojas Villoslado.
Bach. Ing. de Sistemas - Universidad Nacional de Trujillo
Cel. 943648134
RPM: #283166
Best Regards!!
 
S

Sam Weber

Roger said:
Recommend trying 1.9.2 or trying it in irb like
$ ruby --disable-gems -S irb

Here's what happens on my Ubuntu 10.04 box. I may be standing on my air
hose
by attempting to have both 1.8.? installed alongside 1.9.1. I would
like to
whack both and go to 1.9.2 but I'm afraid of making things worse instead
of
better.

[~/sinatra_etudes]$ ruby1.9.1 sinatra1.rb
sinatra1.rb:2:in `require': no such file to load -- sinatra (LoadError)
from sinatra1.rb:2:in `<main>'
[~/sinatra_etudes]$ gem1.9.1 which sinatra
/usr/lib/ruby/gems/1.9.1/gems/sinatra-1.0/lib/sinatra.rb
[~/sinatra_etudes]$ uname -a
Linux lucid1 2.6.32-24-generic #42-Ubuntu SMP Fri Aug 20 14:24:04 UTC
2010 i686 GNU/Linux
[~/sinatra_etudes]$ ruby1.9.1 -v
ruby 1.9.1p378 (2010-01-10 revision 26273) [i486-linux]
[~/sinatra_etudes]$ gem1.9.1 -v
1.3.7
[~/sinatra_etudes]$ ruby1.9.1 --disable-gems -S irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'sinatra'
=> true
irb(main):004:0> exit
[~/sinatra_etudes]$ export GEM_HOME="path_gems"
[~/sinatra_etudes]$ ruby1.9.1 sinatra1.rb
sinatra1.rb:2:in `require': no such file to load -- sinatra (LoadError)
from sinatra1.rb:2:in `<main>'
[~/sinatra_etudes]$ export GEM_HOME="/usr/lib/ruby/gems/1.9.1/gems"
[~/sinatra_etudes]$ ruby1.9.1 sinatra1.rb
sinatra1.rb:2:in `require': no such file to load -- sinatra (LoadError)
from sinatra1.rb:2:in `<main>'

So it works in irb but not from the command line.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top