ruby - 沙发土 bean : no such file to load -- json/add/rails

标签 ruby rubygems

当我“需要”couch_potato gem 时,出现以下错误:

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 还不是特别有经验,所以采用了散弹枪式的方法并卸载了我所有的 gem,然后从 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 吗?我可以让 couch_potato 使用旧的 json gem 版本吗?

最佳答案

您需要安装 JSON gem。

$ gem install json

实际上,json/add/rails 文件已被 JSON 库弃用

# 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 - 沙发土 bean : no such file to load -- json/add/rails,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7442788/

相关文章:

ruby - Ruby 中的随机句子生成器 : How to randomly select values on specific key in hash?

ruby-on-rails - 用于新闻解析片段的 ruby​​ gem

ruby-on-rails - update_attributes ruby​​ on rails 中的数据

RubyGems - 我的系统似乎无法找到任何要安装的远程 gem

ruby-on-rails - Ruby——使用父实例变量的子类

ruby-on-rails - Rails + Twitter Bootstrap : File to import not found or unreadable: twitter/bootstrap

ruby - Rspec:辅助方法未被识别

ruby-on-rails - 保留url参数

ruby - 来自 Tree::TreeNode 的方法不起作用

ruby-on-rails - Gemfile 样式