Reputation: 2057
I'm trying to run a ruby file which imports a gem. The ya2yaml gem is installed, yet somehow it is not found:
$ cat delme.rb require 'rubygems' require 'ya2yaml' $ ruby delme.rb /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- ya2yaml (LoadError) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' from delme.rb:2
I installed the gem using:
sudo gem install ya2yamland I know that the gem is actually installed:
$ gem list --local | grep ya2yaml ya2yaml (0.26)
Also, the following works from a rails program I just downloaded:
sudo rake gemsHowever the following fails:
rake gemsWhich leads me to think that there may be a permissions problem somewhere.
Why can't the gem be found? What can I do to diagnose this?
Thanks!
Upvotes: 0
Views: 1016
Reputation: 757
I've certainly seen this error before. Unfortunately I don't know what causes it. I do know that if you see it on Linux and you've installed gem via your package manager (synaptic / yum / etc) then you can generally fix it by installing gem by hand from their website. The instructions there are pretty straight-forward.
(Your command line looks unix-y, so it seems to me that you may be on Linux. If you're on a Mac, it's certainly worth trying anyway.)
UPDATE: Linux, then. Ta.
Upvotes: 0
Reputation: 7094
Instead of require 'rubygems'
inside delme.rb, try starting ruby with -rubygems:
$ ruby -rubygems delme.rb
Upvotes: 0
Reputation: 227
The thing I would do in a situation like this:
Search for the gem's location on your system. Use this command:
find / -name ya2yaml
Check that the found directory is added to your PATH system variable by doing this:
echo $PATH
If the path where ya2yaml gem is located is not listed in the PATH variable's value, add it:
PATH=$PATH:/gem/location/directory
export PATH
I hope you'll find these steps helpful. Good luck!
Upvotes: 1