TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
- Start Rails server by$ rails server
- This error appears :
=> Booting WEBrick=> Rails 4.1.4 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (–binding option)
=> Ctrl-C to shutdown server
Exiting
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:182:in `rescue in create_default_data_sou
rce’: No source of timezone data could be found. (TZInfo::DataSourceNotFound)
Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error.
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:179:in `create_default_data_
source’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:40:in `block in get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:39:in `synchronize’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/data_source.rb:39:in `get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:629:in `data_source’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:92:in `get’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone_proxy.rb:67:in `real_timezone’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone_proxy.rb:30:in `period_for_utc’
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/tzinfo-1.2.1/lib/tzinfo/timezone.rb:549:in `current_period’
Here is solution:
First of all, you’ll need to make sure that the tzinfo-data gem is being included in your Gemfile
(in your project directory).
Then, check your Gemfile
to see if there is an existing reference to tzinfo-data
. If there isn’t already a reference, then add the following line:
gem ‘tzinfo-data’
You may find that there is already a line like the following:
gem ‘tzinfo-data’, platforms: [:mingw, :mswin]
If you are using a 64-bit version of Ruby on Windows, then add :x64_mingw
to the list of platforms as follows:
Alternatively, you can remove the platforms
option altogether.
After doing this, run bundle update
at the command line to install the tzinfo-data gem and you’ll then be able to start your Rails server or console.