Search code examples
ruby-on-railsrubytzinfo

Ruby on Rails can't connect to localhost:3000, 127.0.0.1:3000 and 0.0.0.0:3000 on Windows


I'm a total newbie learning Ruby on Rails and using a Windows machine. The steps used to install ruby on rails were:

  1. download ruby200-x64 installer for Windows
  2. then run the following commands

    • ruby dk.rb init
    • ruby dk.rb install
    • gem install bundler
    • gem install sqlite3
    • gem install rails
    • rails new testapp
    • cd testapp
    • bundle exec rails server which means that I ran rails server in the testapp folder and part of the output says this:

      • Booting WEBrick
      • Rails 4.1.1 application starting in development on 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
      • 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: No source of timezone data could be found. Please refer to http://tzinfo.github.io/datasourcenotfound for help resolving this error
      • Follow by more lines of codes (sorry, didn't have enough reputation points to post an image.
  3. Finally when I tried to connect to localhost:3000, 127.0.0.1:3000, or 0.0.0.0:3000. None worked. Any ideas? I'm guessing it has to do something with the Exiting line.


Solution

  • The error indicates that TZInfo was unable to find a source of time zone data on your system. This will typically occur if you are using Windows.

    Resolving TZInfo::DataSourceNotFound Errors

    Try to install tzinfo-data gem by editing Gemfile and put gem 'tzinfo-data' and run bundle install

    Or to use the ruby modules as the data source, running by

    gem install tzinfo-data