当我“需要”沙发土豆宝石时,会出现以下错误:

LoadError: no such file to load -- json/add/rails
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `require'
    from /Library/Ruby/Gems/1.8/gems/couch_potato-0.5.7/lib/couch_potato.rb:4
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `gem_original_require'
    from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:59:in `require'
    from (irb):1

我对ruby还不是特别有经验,所以采取了一种散弹枪式的方法,卸载了我所有的gems,然后从couch_potato开始重新安装。json gem是一个需求,因此自动安装了最新版本。但这个问题一直存在。
我想也许是Rails的这部分(因为“Rails”出错了……这看起来是一个很长的过程,但正如前面提到的,我对ruby很陌生,还不完全确定gems是如何工作的:))但是安装在以下几行之后突然结束(这是一个很长的列表之后的最后几行):
Installing RDoc documentation for rack-ssl-1.3.2...
Installing RDoc documentation for rdoc-3.9.4...
Installing RDoc documentation for railties-3.1.0...
Installing RDoc documentation for bundler-1.0.18...
Installing RDoc documentation for rails-3.1.0...
file 'lib' not found

但不管怎样,我还是去寻找丢失的文件。gem文件夹(/library/ruby/gems/1.8/gems/json-1.1.9)中有“lib”和“json/add”,这是一个小小的胜利,但其中没有“rails”文件。
这时我检查了我的笔记本电脑…有一个旧版本的“json”,但文件“json/add/rails”确实存在于那个旧gem中。
在这一点上,我最好的选择是什么?我应该用不同版本的沙发土豆吗?我可以让couch_potato使用较旧的json gem版本吗?

最佳答案

您需要安装json gem。

$ gem install json

实际上,json库不赞成使用json/add/rails文件
# This file used to implementations of rails custom objects for
# serialisation/deserialisation and is obsoleted now.

unless defined?(::JSON::JSON_LOADED) and ::JSON::JSON_LOADED
  require 'json'
end

$DEBUG and warn "required json/add/rails which is obsolete now!"

但看起来couch_potato还没有更新,需求仍然存在。

关于ruby - couch_potato:没有要加载的文件— json/add/rails,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7442788/

10-14 15:04
查看更多