Search code examples
ruby-on-railsrubyserverrubygems

Can't run rails server in windows 11


I want to start ruby server.

I install:

gem install bundler

gem install sqlite3

gem install webpacker

gem install rails

And I create a new rails application.

gem new test_app

Also it's time to run server:

cd test_app

rails server

But I take error shown below

=> Booting Puma
=> Rails 7.0.3 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:159:in `rescue in create_default_data_source': tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install (TZInfo::DataSourceNotFound)
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:156:in `create_default_data_source'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:55:in `block in get'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:54:in `synchronize'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:54:in `get'
from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/activesupport-7.0.3/lib/active_support/railtie.rb:88:in `block in <class:Railtie>'

And similar mistakes


Solution

  • Add this gem to your gemfile.rb

    gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ]