From: Augusto Esteves on
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.
--
Posted via http://www.ruby-forum.com/.

From: Aaron Patterson on
On Thu, Dec 24, 2009 at 01:20:07AM +0900, Augusto Esteves wrote:
> 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!

--
Aaron Patterson
http://tenderlovemaking.com/

From: Roger Pack on
> `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
--
Posted via http://www.ruby-forum.com/.

From: Augusto Esteves on
Roger Pack wrote:
>
> 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



--
Posted via http://www.ruby-forum.com/.

From: Augusto Esteves on
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
--
Posted via http://www.ruby-forum.com/.