'Issues regarding new Ruby On Rails Application
I attempted to make a new app using rails new
command and the bundle is completed. However, it said that rails aborted!
and appeared another error:
Bundle complete! 15 Gemfile dependencies, 70 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
run bundle binstubs bundler
rails importmap:install
rails aborted!
TZInfo::DataSourceNotFound: tzinfo-data is not present. Please add gem 'tzinfo-data' to your Gemfile and run bundle install
C:/Sites/test_001/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:/Sites/test_001/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.
Any help on resolving this will be greatly appreciated. Thank you very much.
Solution 1:[1]
It says that you need to install tzinfo-data gem for your application. Please add
gem 'tzinfo-data', '~> 1.2021', '>= 1.2021.5'
in your application's gemfile.
Thanks
Solution 2:[2]
Actually, I've mixed two of the answers here and it fixed the problem for me on Windows 11.
I've added:
gem 'tzinfo-data', '~> 1.2021', '>= 1.2021.5'
And removed the other part of the gem 'tzinfo-data'
added by default.
Solution 3:[3]
In the gem fille where you see gem "tzinfo-data", platforms: %i[ mingw mswin x64_mingw jruby ], remove platforms and then run gem install tzinfo-data. After you do that run bundle install. Then go back to the original directory where you ran rails new, and run it again with the same name, I managed to get rid of the tzinfo error and the node(package.json) error.
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 | Abhishek Jadav |
Solution 2 | Yeltsin Seal |
Solution 3 | user18765033 |