2

最近我更新到 rails 4.0.0.rc1 并且遇到了一些错误。我目前也在使用 RVM。创建 rails 4 应用程序并运行“rails s”或“rspec rails”后,我得到了错误 -

/Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `initialize': no implicit conversion of nil into Hash (TypeError)
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `new'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/common.rb:67:in `generator='
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:17:in `<module:Ext>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:12:in `<module:JSON>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json/ext.rb:9:in `<top (required)>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:58:in `require'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:58:in `<module:JSON>'
from /Users/metaHunts/.rvm/rubies/ruby-2.0.0-p0/lib/ruby/gems/2.0.0/gems/json-1.7.7/lib/json.rb:54:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object/to_json.rb:3:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object/to_json.rb:3:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object.rb:11:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0.rc1/lib/active_support/core_ext/object.rb:11:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/configuration.rb:3:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/configuration.rb:3:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/railtie.rb:2:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/railtie.rb:2:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:1:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/engine.rb:1:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/application.rb:4:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/application.rb:4:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails.rb:9:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails.rb:9:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:2:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/activerecord-4.0.0.rc1/lib/active_record/railtie.rb:2:in `<top (required)>'
from /Users/metaHunts/Desktop/TeenStarter/config/application.rb:4:in `require'
from /Users/metaHunts/Desktop/TeenStarter/config/application.rb:4:in `<top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `require'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:78:in `block in <top (required)>'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `tap'
from /Users/metaHunts/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0.rc1/lib/rails/commands.rb:75:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'

我尝试过重新加载 rvm,清理和修复它,但我一直收到同样的错误。能否请我帮忙修复它。

提前致谢 :)

4

2 回答 2

3

有同样的问题。出于某种原因,我不知道它通过运行得到了修复:

gem install json -v 1.7.7
于 2014-02-07T19:48:21.660 回答
0

通过删除 RVM 解决

rvm implode

在使用 rvm 网站 ( https://rvm.io/ ) 上的命令重新安装之前。

于 2013-05-08T10:45:26.577 回答