Whenever I require a file in ruby or irb I get this error:
LoadError: no such file to load -- (insert any filename).rb
from <internal:lib/rubygems/custom_require>:29:in `require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from (irb):1
from /usr/bin/irb1.9.1:12:in `<main>'
It happens even if the file exists I am using ruby1.9.1 and to my knowledge, I have not installed rubygems. I am running on Ubuntu 10.10 Maverick Meerkat. Please help, this problem is very annoying! Thanks in advance, ell.
EDIT: I forgot to say that no matter where the file is, even if its in the same directory and definately exists I always get this error.
Rubygems is installed with ruby 1.9 by default.
Check that the file you are trying to load is in a directory listed in the variable $: or specify the entire path to the file in the require. Or, add the directory to $: explicitly:
In Ruby 1.9.2, which I guess is the version you are using, the current directory is no longer in the
$LOAD_PATH
. If you want torequire
files relative to the path of the file that therequire
call is in, you should userequire_relative
instead.If you really want to
require
files relative to the current directory, then you can add the current directory to the$LOAD_PATH
like so:However, this change was made for a reason, so you shouldn't do that lightly. After all, this will make your app behave more or less randomly, depending on what directory you just happened to be in, when you started the app. Worse, an attacker can get you to execute arbitrary code on his behalf if he can get you to run the app from a directory under his control.
Are you using p0? I got that a lot on
ruby-1.9.2-p0
. Try doing an unlinked (e.g., no using--with-baseruby
)./configure
set, in other wordsfrom the beginning. For me, that fixed
syck
not being there (though a different problem sprug up:/
),yaml
, evenstringio
andzlib
!