2017-04-02 61 views
1

我在Linux上安裝了Ruby 2.4.1和Rails 5.0.2。創建一個新的Rails項目後,我收到以下錯誤運行「軌道的服務器」後:啓動新服務器時出現Rails錯誤:無效的時區

/home/___/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.2/lib/active_support/core_ext/time/zones.rb:98:in `rescue in find_zone!': Invalid Timezone: UTC (ArgumentError) 
     from /home/___/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.2/lib/active_support/core_ext/time/zones.rb:81:in `find_zone!' 
     from /home/___/.rvm/gems/ruby-2.4.1/gems/activesupport-5.0.2/lib/active_support/railtie.rb:25:in `block in <class:Railtie>' 
     from /home/___/.rvm/gems/ruby-2.4.1/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `instance_exec' 
     from /home/___/.rvm/gems/ruby-2.4.1/gems/railties-5.0.2/lib/rails/initializable.rb:30:in `run' 
     from /home/___/.rvm/gems/ruby-2.4.1/gems/railties-5.0.2/lib/rails/initializable.rb:55:in `block in run_initializers' 
     from /home/___/.rvm/rubies/ruby-2.4.1/lib/ruby/2.4.0/tsort.rb:228:in `block in tsort_each' 
... 

這看起來類似問題someWindows users了一段時間回來,但我試過fix suggested(添加「要求「 tzinfo'「給environment.rb),並且仍然有同樣的問題。

回答

1

檢入application.rb命令:config.time_zone正在運行。如果沒有,請嘗試添加以下行:

config.time_zone = "Eastern Time (US & Canada)"(在application.rb'。)

讓我知道是否能解決它!

+0

修復它,謝謝。沒有運行'config.time_zone'。一旦我在Application類中運行它,服務器啓動正常。 –

+0

很高興能有所幫助 – mtaff