我在Linux上安装了新的Ruby 2.4.1和Rails 5.0.2。创建新的Rails项目后,运行“rails server”后出现以下错误:
/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'
...
这类似于some Windows users有一段时间的问题,但我尝试了fix suggested(向environment.rb添加“require'tzinfo”),仍然有同样的问题。
答案 0 :(得分:2)
检入application.rb
正在运行命令:config.time_zone
。如果不是,请尝试添加以下行:
config.time_zone = "Eastern Time (US & Canada)"
(application.rb'
。)
如果能解决问题,请告诉我!