Ruby Strange Error

有些话、适合烂在心里 提交于 2019-12-02 11:39:07

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:

$: << '/my/lib/path'
require 'mylib'

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 to require files relative to the path of the file that the require call is in, you should use require_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:

$LOAD_PATH << '.'

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 words

curl ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p136.tar.gz | tar xz
cd ruby-1.9.2-p136
./configure
make -j2
sudo make install

from the beginning. For me, that fixed syck not being there (though a different problem sprug up :/), yaml, even stringio and zlib!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!