2017-04-10 70 views
1

我想使用Rails 4.2.3,並且我設法使用rbenv和gem來安裝它。當啓動服務器我得到這個錯誤:在Mac上啓動Rails服務器時出現故障

rails server 
=> Booting WEBrick 
=> Rails 4.2.3 application starting in development on http://localhost:3000 
=> Run `rails server -h` for more startup options 
=> Ctrl-C to shutdown server 
/Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Fixnum is deprecated 
/Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:121: warning: constant ::Bignum is deprecated 
Exiting 
/Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:124:in `block (2 levels) in <class:Numeric>': stack level too deep (SystemStackError) 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/activesupport-4.2.3/lib/active_support/core_ext/numeric/conversions.rb:131:in `block (2 levels) in <class:Numeric>' 
    ... 5542 levels... 
    from /Users/macuser/.rbenv/versions/2.4.0/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' 
    from /Users/macuser/dreamer_me/bin/spring:15:in `<top (required)>' 
    from bin/rails:3:in `load' 
    from bin/rails:3:in `<main>' 
+0

感謝您的幫助@Swards。 rbenv版本 系統 * 2.4.0(由/Users/macuser/.rbenv/version設置) 我在哪裏可以找到.ruby版本?按照應用程序級別,你的意思是在運行「rails new」時創建的目錄。 – khatman

+0

是的,將.ruby-version(這是文件名和。)放在與/ app相同的級別。然後你可以通過rbenv安裝來添加ruby - 例如'rbenv install 2.2.2' – Swards

回答

1

你正在運行的Ruby 2.4,你可以通過在應用水平.ruby-version文件中設置它改變你的Ruby版本。

# .ruby-version 
2.2.2 

或者任何你喜歡的東西。你可以看看你有什麼可用的紅寶石版本

$ rbenv versions 
+0

這裏的問題在於,我將Ruby的最新版本與早期版本的Rails混合在一起,兩者並不相配。看起來Rails已經要求* Fixnum *和* Bignum *,從版本2.4開始已經棄用了。 我認爲任何早於2.4的版本在這兩個版本被棄用之前都可以使用。我卸載了Ruby 2.4.0並安裝了Ruby 2.2.2,它工作。 **大喊@Swards幫我出去**。 – khatman

相關問題