需要 yajl 时发生 LoadError
我已经在 ubuntu 10.04 安装上安装了 yajl、libyajl-dev 和 yajl-ruby gem。
我将 gem 添加到了 2.3.8 ruby on Rails 安装中,因为 2.3.6 的发行说明表明如果系统中存在 yajl 将被使用。 Rails 会显示一条错误消息,类似于“无法加载 yajl-ruby”,所以我想我会看到 irb 会话中发生了什么。发生的事情是这样的:
$ dpkg -l | grep yajl
ii libyajl-dev 1.0.8-1 Yet Another JSON Library - development files
ii libyajl1 1.0.8-1 Yet Another JSON Library
ii yajl-tools 1.0.8-1 Yet Another JSON Library - tools
$ gem list | grep yajl
yajl-ruby (0.7.6)
$ irb
> require 'yajl'
LoadError: no such file to load -- yajl
from (irb):1:in `require'
from (irb):1
from :0
> require 'yajl/gzip'
LoadError: no such file to load -- yajl/gzip
from (irb):2:in `require'
from (irb):2
from :0
> require 'yajl-ruby'
LoadError: no such file to load -- yajl-ruby
from (irb):3:in `require'
from (irb):3
from :0
在花了一段时间搜索这个问题后,我找不到其他人遇到这个问题。有人知道发生了什么事吗?
I have installed yajl, libyajl-dev, and the yajl-ruby gem on a ubuntu 10.04 installation.
I added the gem to a 2.3.8 ruby on rails installation since the release notes for 2.3.6 indicated that yajl would be used if present in the system. Rails bails with an error message along the lines of 'unable to load yajl-ruby' so I thought I would see what is happening in an irb session. This is what happens:
$ dpkg -l | grep yajl
ii libyajl-dev 1.0.8-1 Yet Another JSON Library - development files
ii libyajl1 1.0.8-1 Yet Another JSON Library
ii yajl-tools 1.0.8-1 Yet Another JSON Library - tools
$ gem list | grep yajl
yajl-ruby (0.7.6)
$ irb
> require 'yajl'
LoadError: no such file to load -- yajl
from (irb):1:in `require'
from (irb):1
from :0
> require 'yajl/gzip'
LoadError: no such file to load -- yajl/gzip
from (irb):2:in `require'
from (irb):2
from :0
> require 'yajl-ruby'
LoadError: no such file to load -- yajl-ruby
from (irb):3:in `require'
from (irb):3
from :0
I cannot find anyone else with this problem after spending a while searching for this issue. Anyone have any idea what is going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 gem 代替
sudo gem install yajl-ruby
然后像 ruby 脚本中的任何其他 gem 一样使用它
Use the gem instead
sudo gem install yajl-ruby
Then just use it like any other gem in your ruby script