TZInfo::DataSourceNotFound error starting Rails v4

2019-01-04 10:16发布

I have created a new application using Ruby on Rails v4.1.0. When attempting to start a server or console on Windows, I am encountering the following error:

$ rails server
Booting WEBrick
Rails 4.1.0 application starting in development on ....

Exiting
c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/tzinfo-1.1.0/lib/tzinfo/data_source.rb:199:
in `rescue in create_default_data_source': 
No timezone data source could be found. To resolve this, either install 
TZInfo::Data (e.g. by running `gem install tzinfo-data`) or specify a zoneinfo 
directory using `TZInfo::DataSource.set(:zoneinfo, zoneinfo_path)`.
(TZInfo::DataSourceNotFound) 
from c:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/tzinfo-1.1.0/lib/tzinfo/data_source.rb:196:
in `create_default_data_source'

How can I resolve this error?

8条回答
狗以群分
2楼-- · 2019-01-04 10:46

I had to add two gems to get the server to start..

gem 'tzinfo-data'
gem 'tzinfo'

Then bundle install.

查看更多
狗以群分
3楼-- · 2019-01-04 10:48

Maybe tzinfo is not installed on your system, try to install it:

 gem install tzinfo
 gem install tzinfo-data
查看更多
登录 后发表回答