You must either be running with node (package.json)... Error while creating new app on rails

526 Views Asked by At
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

1

There are 1 best solutions below

0
On

In 8 Simple Steps

  1. Go to file explorer and open the app_name folder you just tried to create.

  2. open the file named Gemfile in any notepad

  3. 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.

  4. 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".

  5. Save the file. You are now good to go on your cmd again.

  6. In the cmd run: cd app_name to open the directory of the app you tried to create.

  7. Now run: bundle install

  8. After that, you can run: rails importmap:install again or recreate your app entirely.

Thank you, have a nice day