我最近冻结了我的Windows计算机并安装了ruby
和rubyonrails
。当我使用rails new FirstApp
创建一个新的rails项目时,它工作正常,但当我尝试使用rails s
启动rails服务器时,它会抛出下面提到的错误:
C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-4.1.0.beta1/l
ib/active_support/core_ext/time/zones.rb:70:in `rescue in find_zone!': uninitial
ized constant TZInfo::InvalidTimezoneIdentifier (NameError)
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.1.0.beta1/lib/active_support/core_ext/time/zones.rb:55:in `find_zone!'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/activesupport-
4.1.0.beta1/lib/active_support/railtie.rb:20:in `block in <class:Railtie>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/initializable.rb:30:in `instance_exec'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/initializable.rb:30:in `run'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/initializable.rb:55:in `block in run_initializers'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block i
n tsort_each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:183:in `block (
2 levels) in each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:219:in `each_st
rongly_connected_component_from'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:182:in `block i
n each_strongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_st
rongly_connected_component'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/2.0.0/tsort.rb:148:in `tsort_e
ach'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/initializable.rb:54:in `run_initializers'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/application.rb:285:in `initialize!'
from E:/rubydemo/test3/config/environment.rb:5:in `<top (required)>'
from E:/rubydemo/test3/config.ru:3:in `require'
from E:/rubydemo/test3/config.ru:3:in `block in <main>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `instance_eval'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/builder.rb:55:in `initialize'
from E:/rubydemo/test3/config.ru:in `new'
from E:/rubydemo/test3/config.ru:in `<main>'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/builder.rb:49:in `eval'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/builder.rb:49:in `new_from_string'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/builder.rb:40:in `parse_file'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/server.rb:277:in `build_app_and_options_from_config'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/server.rb:199:in `app'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/server.rb:50:in `app'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/rack-1.5.2/lib
/rack/server.rb:314:in `wrapped_app'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/server.rb:130:in `log_to_stdout'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/server.rb:67:in `start'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/commands_tasks.rb:81:in `block in server'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/commands_tasks.rb:76:in `tap'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/commands_tasks.rb:76:in `server'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands/commands_tasks.rb:40:in `run_command!'
from C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/railties-4.1.0
.beta1/lib/rails/commands.rb:17:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
任何人都可以帮我理解这里的问题以及如何解决它?
我正在使用ruby 2.0.0p195 (2013-05-14) [i386-mingw32]
和Rails 4.1.0.beta1
答案 0 :(得分:1)
似乎这是Windows上的一个问题。这里有一个类似的question可能会帮助你。希望这会有所帮助。
答案 1 :(得分:1)
最后,摆脱了这个问题。
确保在gem 'tzinfo'
条目之前将tzinfo-data
添加到您的Gemfile中,一切都将开始工作。
参考:https://github.com/rails/rails/issues/13553