Bundler warning when running "bundle" - Ruby on Rails

I had a similar challenge on my Ubuntu 20.04; ruby (2.7.1); rails (6.0.3.3):

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java.

After running some searches, I found a fix on a git site page:

bundle config disable_platform_warnings true

I realized it wasn't an error but a time-zone dependency warning applicable to running rails application on Windows environment. Adding the disable_platform_warnings option for Bundler helps to silence platform warnings globally for the current machine.

You can read more at https://github.com/tzinfo/tzinfo-data/issues/12


Just remove this line from your Gemfile

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

because you obviously do not run your application on any of these platforms.

Then run bundle install again.


Alternatively you can keep the tzinfo-data gem and just remove the platform part and it should become something like this:

gem 'tzinfo-data', '>= 1.2016.7' # Don't rely on OSX/Linux timezone data

Recently the RoR creator DHH has published Basecamp's most recent application's Gemfile for Hey! and it contains the line above.

Hope that can become useful for others as it was for me.