Ruby奇怪的错误 [英] Ruby Strange Error

查看:112
本文介绍了Ruby奇怪的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  LoadError:没有要加载的文件 - (插入任何文件名).rb 
from< internal:lib / ruby​​gems / custom_require>:29:在'require'
from< internal:lib / ruby​​gems / custom_require>:29:in'require '来自(irb)的
:1
来自/usr/bin/irb1.9.1:12:in`< main>'

即使文件存在,也会发生
我正在使用ruby1.9.1,而据我所知,我还没有安装rubygems。我在Ubuntu 10.10 Maverick Meerkat上运行。请帮忙,这个问题很烦人!预先感谢,埃尔。



编辑:我忘了说,无论文件在哪里,即使它在同一目录中并且明确存在,我总是会得到这个错误。

解决方案

Rubygems默认安装了ruby 1.9。检查您要加载的文件是否在变量$:中列出的目录中,或者在require中指定文件的完整路径。或者,将目录明确地添加到$:

  $:<< '/ my / lib / path'
需要'mylib'


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:

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

这篇关于Ruby奇怪的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆