【问题标题】:Rails Server fails to start on Ubuntu (was on MAC before), directly exitingRails Server 无法在 Ubuntu 上启动(之前在 MAC 上),直接退出
【发布时间】:2017-06-12 02:19:26
【问题描述】:

根据我的问题here,我现在设置了一个 linux 系统,试图让它运行。重复:

  • 我有一个在 MAC OS X 系统上使用 RoR v 4.2.4 开发的网站
  • 我们需要对这个网站做一点调整,然后部署到服务器上(服务器以后可以使用新的linux系统)

这一次我可以毫无问题地更新所有的宝石。 bundle check 表示所有依赖项都已满足。不幸的是,当我尝试使用rails server 启动服务器以测试网站时,出现以下错误

    Array values in the parameter to `Gem.paths=` are deprecated.
    Please use a String or nil.
    An Array ({"GEM_PATH"=>["/home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0", "/home/XWebsite/.gem/ruby/2.4.0"]}) was passed in from bin/rails:3:in `load'
    /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
    => Booting Puma
    => Rails 4.2.4 application starting in development on http://localhost:3000
    => Run `rails server -h` for more startup options
    => Ctrl-C to shutdown server
    /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/thread_safe-0.3.5/lib/thread_safe/cache.rb:155: warning: constant ::Fixnum is deprecated
    /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated
    /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated
    Exiting
    /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError)
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.4/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>'
     ... 4088 levels...
    from /home/XWebsite/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:68:in `require'
    from /home/XWebsite/XWebsite/bin/spring:13:in `<top (required)>'
    from bin/rails:3:in `load'
    from bin/rails:3:in `<main>'

我们也尝试将 Webrick 作为服务器,但错误是相同的,除了:'Booting WEBrick'

使用rails new blog 创建/开发一个新网站并运行服务器可以在 linux 系统上完美运行。

非常感谢您提前提供的帮助

【问题讨论】:

  • 谢谢!这至少修复了第一个错误:错误消息的前 3 行已消失。但是从/home/XWebsite [...] cache.rb:155: warning: constant ::Fixnum is deprecated 行来看,消息保持不变
  • 你使用的 ruby​​ 版本是什么??
  • ruby 2.4.0p0 (2016-12-24 revision 57164) 和 Rails 5.0.1,但网站是在 Rails 4.2.4 中开发的
  • 请考虑使用 rails 4.2 和与您的 rails 4.2.4 项目兼容的 ruby​​ 版本
  • 你在使用thread_safe gem吗?如果您查看自述文件,它已被弃用,而支持concurrent-ruby

标签: ruby-on-rails ruby linux macos


【解决方案1】:
  1. bundle update spring
  2. bundle exec spring binstub --remove --all
  3. bundle exec spring binstub --all

【讨论】:

    猜你喜欢
    • 2021-03-31
    • 1970-01-01
    • 2012-12-20
    • 2012-12-11
    • 2019-10-25
    • 2017-07-08
    • 2015-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多