TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install
C:/railsfriends/friends/config/environment.rb:5:in `<main>'
Caused by:
TZInfo::DataSources::ZoneinfoDirectoryNotFound: None of the paths included in TZInfo::DataSources::ZoneinfoDataSource.search_path are valid zoneinfo directories.
C:/railsfriends/friends/config/environment.rb:5:in `<main>'
Tasks: TOP => app:template => environment
(See full trace by running task with --trace)
rails turbo:install stimulus:install
# You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem.
You must either be running with node (package.json) or importmap-rails (config/importmap.rb) to use this gem.
To solve this, Stay in the same directory do nothing, then type this specific command
$ gem install tzinfo-data
to install tzinfo-data
In 8 Simple Steps
Go to file explorer and open the app_name folder you just tried to create.
open the file named Gemfile in any notepad
Find gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ] in the text and make sure it is not commented, if so uncomment the line of the code.
Now if you see gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ], remove the rest of this line after gem "tzinfo-data" now you should see just gem "tzinfo-data".
Save the file. You are now good to go on your cmd again.
In the cmd run: cd app_name to open the directory of the app you tried to create.
Now run: bundle install
After that, you can run: rails importmap:install again or recreate your app entirely.
Thank you, have a nice day