Thursday, July 31, 2008

No such file to load -- ubygems (LoadError)

Whatever Ruby module I want to install under Cygwin I always get the same
error: ruby: No such file to load -- ubygems (LoadError)

I've tried install rubygem, rubyfcgi etc. After "ruby config.rb config" or
"ruby config.rb install" I get error: "ruby: No such file to load --
ubygems (LoadError)" It looks strange. I am using last cygwin installation
with ruby 1.8.2 ()ruby 1.8.2 (2004-12-25) [i386-cygwin])

----

True. Try to unset the RUBYOPT environment variable. Did the trick for me.

On Dec 28, 2006, at 16:30, Paul van Delst wrote:

> I just did a complete re-install of ruby 1.8.5-p12 and
> rubygems-0.9.0 and I'm getting the old sawhorse error:
>
> ruby: no such file to load -- ubygems (LoadError)
>
> I've searched the newsgroup, but nothing seems to address the
> problem I'm having (I think). Here's what I did:
>
> 0) rm -fr'd my "ruby" and "rubygems" installation directories in my
> $HOME/local (I do not have root access to the computer in
> question). Also unset RUBYOPT.
>
> ruby install
> ------------
> 1) Installed ruby 1.8.5-p12. No problems
> 2) Modified my login script with:
> export PATH=$PATH:${HOME}/local/ruby/bin
> ruby and irb run fine.
>
> rubygems install
> ----------------
> 3) Specified where I want gems to actually go,
> export GEM_HOME=${HOME}/local/rubygemrepository
> 4) ruby setup.rb config --codefix=${HOME}/local/rubygems

This tells ruby to put ubygems.rb under ~/local/rubygems.

> 5) ruby setup.rb setup
> 6) ruby setup.rb install
> ....
> Successfully built RubyGem
> Name: sources
> Version: 0.0.1
> File: sources-0.0.1.gem

This puts ubygems.rb under ~/local/rubygems.

> 7) In login script added
> export GEM_HOME=${HOME}/local/rubygemrepository
> export PATH=$PATH:${HOME}/local/rubygems/bin
> and
> export RUBYOPT="rubygems"
>
>
> Now I want to install a gem (Bil Kleb's funit) and I did:
>
> gem install funit
>
> and got the error:
>
> ruby: no such file to load -- ubygems (LoadError)
>
> And, of course, ruby and irb no longer work either (same error).

ubygems.rb is not in your $LOAD_PATH for ruby.

> O.k., so what did I do wrong? *After* I installed rubygems I set
> the RUBYOPT envar. But, ruby can't seem to find anything rubygem
> related.
>
> Is there some other magical envar that I need to set so that ruby
> and rubygems play nice?

You probably want to add:

export RUBYLIB=${HOME}/local/rubygems

> Or should I install rubygem "inside" my ruby install? In:
> ${HOME}/local/ruby/lib/ruby/site_ruby/1.8/i686-linux ?
> or
> ${HOME}/local/ruby/lib/ruby/site_ruby
> or
> ??

This is how rubygems is typically installed (by not supplying the --
codefix option in step 4). But you do not have root access. You just
needed to add rubygems to the $LOAD_PATH.

> I followed the notes I made last time I did this[*] and it worked
> then, so I've screwed something up somewhere; I just don't know what.

No comments:

Post a Comment