heroku toolbelt`initialize':没有将nil隐式转换为Hash(TypeError)

时间:2014-07-22 08:07:08

标签: ruby-on-rails heroku

我检查了系统更新,显示heroku和heroku toolbelt都已更新,但之后我收到此错误

heroku/vendor/gems/json-1.7.7/lib/json/common.rb:67:in `initialize': no implicit conversion of nil into Hash (TypeError)

无法运行任何heroku命令。以前它工作正常,但现在不行。

heroku,heroku-versions 3.9.4,之前是3.9.1

 xxxxx@xxxxx:~$ heroku 
/usr/local/heroku/vendor/gems/json-1.7.7/lib/json/common.rb:67:in `initialize': no implicit conversion of nil into Hash (TypeError)
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json/common.rb:67:in `new'
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json/common.rb:67:in `generator='
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json/ext.rb:17:in `<module:Ext>'
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json/ext.rb:12:in `<module:JSON>'
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json/ext.rb:9:in `<top (required)>'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json.rb:58:in `<module:JSON>'
    from /usr/local/heroku/vendor/gems/json-1.7.7/lib/json.rb:54:in `<top (required)>'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/heroku/lib/heroku/cli.rb:18:in `<top (required)>'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /home/akaruilabs/.rvm/rubies/ruby-2.0.0-p353/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
    from /usr/local/heroku/bin/heroku:23:in `<main>'

2 个答案:

答案 0 :(得分:2)

我有同样的错误。请注意,产生错误的json库不是来自您的宝石,而是带有一个heroku工具带分配。因此更新json是不够的,我认为这应该作为一个错误报告给heroku。

我现在的解决方法是安装一个新的json gem并从heroku toolbelt中删除其过时的版本1.7.7

gem install json
sudo mv /usr/local/heroku/vendor/gems/json-1.7.7 /some/tmp
gem list json
  *** LOCAL GEMS ***
  json (1.8.1)
heroku version
  heroku-toolbelt/3.9.4 (x86_64-linux) ruby/2.1.1

更新:似乎此问题已在3.9.5中修复

答案 1 :(得分:0)

当我犯下Heroku时,我得到了:

/app/vendor/lpxc/lpxc.rb:94: [BUG] hooks/pre-receive:99:in `exit': no implicit conversion from nil to integer (TypeError)
    from hooks/pre-receive:99:in `<main>'

我通过在本地运行bundle install来解决它,并将更新后的Gemfile.lock提交给Heroku。