'rails server not running exiting

This is the output I have obtained when run rails server. I am new to ROR and the version is 3.1.0. Any help would be appreciated

I am running this in windows 10 setup. If you need more details please let me know i can provide. I am by profession Php/ Asp.net developer and mostly worked on frameworks like MVC laravel, CodeIgniter and Yii2

  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.2.2/lib/active_support/railtie.rb:88:in `block in <class:Railtie>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `run'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'       
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/application.rb:372:in `initialize!'
            from C:/xampp/htdocs/simple-app/config/environment.rb:5:in `<main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:42:in `require_relative'
            from config.ru:3:in `block in <main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'   
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:36:in `start' 
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:143:in `block 
    in perform'
            from <internal:kernel>:90:in `tap'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:134:in `perform'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command/base.rb:87:in `perform'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command.rb:48:in `invoke'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands.rb:18:in `<main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from bin/rails:4:in `<main>'
    C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_sources/zoneinfo_data_source.rb:232:in `initialize': None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid zoneinfo directories. (TZInfo::DataSources::ZoneinfoDirectoryNotFound)
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:157:in `new'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/tzinfo-2.0.4/lib/tzinfo/data_source.rb:157: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.2.2/lib/active_support/railtie.rb:88:in `block in <class:Railtie>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `instance_exec'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:32:in `run'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:61:in `block in run_initializers'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:228:in `block in tsort_each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:431:in `each_strongly_connected_component_from'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:349:in `block in each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `call'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:347:in `each_strongly_connected_component'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:226:in `tsort_each'
            from C:/Ruby31-x64/lib/ruby/3.1.0/tsort.rb:205:in `tsort_each'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/initializable.rb:60:in `run_initializers'       
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/application.rb:372:in `initialize!'
            from C:/xampp/htdocs/simple-app/config/environment.rb:5:in `<main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/zeitwerk-2.5.4/lib/zeitwerk/kernel.rb:35:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:42:in `require_relative'
            from config.ru:3:in `block in <main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `eval'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:116:in `new_from_string'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:105:in `load_file'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/builder.rb:66:in `parse_file'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:349:in `build_app_and_options_from_config'   
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:249:in `app'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/rack-2.2.3/lib/rack/server.rb:422:in `wrapped_app'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:76:in `log_to_stdout'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:36:in `start' 
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:143:in `block 
    in perform'
            from <internal:kernel>:90:in `tap'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands/server/server_command.rb:134:in `perform'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command/base.rb:87:in `perform'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/command.rb:48:in `invoke'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/railties-7.0.2.2/lib/rails/commands.rb:18:in `<main>'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/bootsnap-1.10.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
            from bin/rails:4:in `<main>'

I have already run bundle install and bundle update Also my Gemfile looks like this

source "https://rubygems.org"
  git_source(:github) { |repo| "https://github.com/#{repo}.git" }

  ruby "3.1.0"

  # Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
  gem "rails", "~> 7.0.2", ">= 7.0.2.2"

  # The original asset pipeline for Rails [https://github.com/rails/sprockets-rails]
  gem "sprockets-rails"

  # Use sqlite3 as the database for Active Record
  gem "sqlite3", "~> 1.4"

  # Use the Puma web server [https://github.com/puma/puma]
  gem "puma", "~> 5.0"

  # Use JavaScript with ESM import maps [https://github.com/rails/importmap-rails]
  gem "importmap-rails"

  # Hotwire's SPA-like page accelerator [https://turbo.hotwired.dev]
  gem "turbo-rails"

  # Hotwire's modest JavaScript framework [https://stimulus.hotwired.dev]
  gem "stimulus-rails"

  # Build JSON APIs with ease [https://github.com/rails/jbuilder]
  gem "jbuilder"

  # Use Redis adapter to run Action Cable in production
  # gem "redis", "~> 4.0"

  # Use Kredis to get higher-level data types in Redis [https://github.com/rails/kredis]
  # gem "kredis"

  # Use Active Model has_secure_password [https://guides.rubyonrails.org/active_model_basics.html#securepassword]
  # gem "bcrypt", "~> 3.1.7"

  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw]

  # Reduces boot times through caching; required in config/boot.rb
  gem "bootsnap", require: false

  # Use Sass to process CSS
  # gem "sassc-rails"

  # Use Active Storage variants [https://guides.rubyonrails.org/active_storage_overview.html#transforming-images]
  # gem "image_processing", "~> 1.2"

  group :development, :test do
    # See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
    gem "debug", platforms: %i[ mri mingw x64_mingw ]
  end

  group :development do
    # Use console on exceptions pages [https://github.com/rails/web-console]
    gem "web-console"

    # Add speed badges [https://github.com/MiniProfiler/rack-mini-profiler]
    # gem "rack-mini-profiler"

    # Speed up commands on slow machines / big apps [https://github.com/rails/spring]
    # gem "spring"
  end

  group :test do
    # Use system testing [https://guides.rubyonrails.org/testing.html#system-testing]
    gem "capybara"
    gem "selenium-webdriver"
    gem "webdrivers"
  end


Solution 1:[1]

change(in Gemfile - this line is currently added by default in windows):

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

to:
gem 'tzinfo-data'
then run command:
bundle update
this will may fix your problem

--why this bug happen?--
im new to Ruby on Rails - RoR
im using:
ruby 3.1.1p18 (2022-02-18 revision 53f5fc4236) [x64-mingw-ucrt]
Rails 7.0.2.2
gem 3.3.7
as far as i've known by searching on google, RoR is currently doesnt work on windows x64-mingw-ucrt, you can check yours by command:
C:\xxx\xxx>ruby -v
or:
C:\xxx\xxx>bundle platform
output:
Your platform is: x64-mingw-ucrt

Solution 2:[2]

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

-> # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem "tzinfo-data"

2)Uninstall tzinfo-data -> $ gem uninstall tzinfo-data

3)-> $ bundle install

4)Install tzinfo-data -> $ gem install tzinfo-data

NB; if you had not installed tzinfo-data to perform uninstall tzinfo-data start from 4) Hope this helps :)

Solution 3:[3]

Your information provided isn't enough to be of help. But from a wild guess from the console, I'll advice you do the following:

  • Check if you have a database connected to the application
  • Restart your server

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DokuroGitHub
Solution 2 Samuel Takyi
Solution 3 larry danso