红宝石升级后启动Rails Server时出错

时间:2019-11-14 18:31:49

标签: ruby-on-rails

我正在使用Ruby 2.2和Rails 4.2.0,并且一切正常 但是自从Ruby升级到2.4.0以来,我收到以下错误消息。我也在Ruby 2.6.5中尝试过。一样。请帮忙!

rails s
/Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/roxml-3.3.1/lib/roxml/definition.rb:156: warning: constant ::Fixnum is deprecated
/Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
/Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
/Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.0/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
   ... 4818 levels...
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
  from /Users/varunaggarwal/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
  from bin/rails:8:in `require'
  from bin/rails:8:in `<main>'

1 个答案:

答案 0 :(得分:2)

我在这里(https://github.com/rails/rails/issues/27670)读到Ruby 2.4需要Rails 4.2.8或更高版本。将Rails从4.2.0升级到4.2.8即可解决。

在gemfile中,我将gem'rails','4.2.0'更改为gem'rails','4.2.8'