【问题标题】:Ruby on Rails - rails server exits immediately after starting (SystemStackError)Ruby on Rails - rails 服务器在启动后立即退出 (SystemStackError)
【发布时间】:2017-01-27 21:21:20
【问题描述】:

我在 C 驱动器中使用 Windows 10 bash 设置了 Ruby on Rails。我使用 rbenv 进行设置并将我的 ruby​​ 版本更新到 2.4.0。然后,我将 rails 版本更新为 4.2.6 并运行 bundle update 来更新我的 gem,我运行 rails server,但它没有启动服务器。相反,它立即退出服务器并向我显示以下错误:

/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155:警告:常量::不推荐使用 Fixnum /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155:警告:常量 ::Fixnum 已弃用 /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/fspath-3.0.1/lib/fspath.rb:154:警告:常量 ::Fixnum 已弃用 => 引导薄 => Rails 4.2.7.1 应用程序开始在http://localhost:3000 上开发 => 运行rails server -h 以获得更多启动选项 => Ctrl-C 关闭服务器 /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155:警告:常量 ::Fixnum 已弃用 /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:121:警告:常量: :Fixnum 已弃用 /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:121:警告:常量: :Bignum 已弃用 退出 /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:124:in block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError) from /home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:131:in块(2级)在' 来自/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:131:in @987654324 @block(2 级)在 ' 来自/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:131:in @987654325 @block(2 级)在 ' 来自/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:131:in @987654326 @block(2 级)在 ' 来自/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.7.1/lib/active_support/core_ext/numeric/conversions.rb:131:in @987654327 @run_command! 来自/home/yschang/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/railties-4.2.7.1/lib/rails/commands.rb:17:in <top (required)>' from bin/rails:4:inrequire' 从 bin/rails:4:in `'

非常感谢任何帮助。谢谢。

【问题讨论】:

    标签: bash ruby-on-rails-4 rubygems windows-10


    【解决方案1】:

    在 Ruby 2.3.x 或更早版本中,有一个基类 Integer,您不能直接对其进行实例化或寻址。取而代之的是,您可以处理具有有限精度的假定快速的 Fixnum 或可以处理非常大的数字的假定较慢的 Bignum。

    在 Ruby 2.4.0 中,维护者做出了“弃用”Fixnum 和 Bignum 的真正令人惊讶的决定,将它们都转为 Integer。任何使用 Fixnum 或 Bignum 的代码都会收到警告。任何测试或其他代码自省例如 42 类将得到答案 Integer 而不是 Fixnum

    对于想要在 Ruby 2.3.x 或更早版本或 2.4.0 或更高版本上运行的实际代码(例如 gem),这是一个非常、非常难以处理的更改。

    Rails 4.2 早于 Ruby 2.4,我不知道它是否完全兼容。我的猜测是,将系统的 Ruby 降级到 2.3.3 会解决您的问题。它肯定会消除所有污染控制台的警告,如果崩溃仍然发生,则更有可能看到相关消息,从而揭示根本原因。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-12
      • 1970-01-01
      • 2017-01-23
      • 2015-10-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-02
      相关资源
      最近更新 更多