Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"The dependency tzinfo-data will be unused" on Ubuntu #12

Closed
terracotta210 opened this issue Feb 13, 2017 · 7 comments
Closed

"The dependency tzinfo-data will be unused" on Ubuntu #12

terracotta210 opened this issue Feb 13, 2017 · 7 comments

Comments

@terracotta210
Copy link

terracotta210 commented Feb 13, 2017

When I run "rails new appname" command I get this message

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 mingw, mswin, x64_mingw, jruby.

I've tried
gem install tzinfo-data

but it didn't help.
I've also tried bundle lock --add-platform mingw, mswin, x64_mingw, jruby as the message suggested but it only works for particular app and every time I create a new app I see the message again.

Ubuntu 14.04,
Ruby 2.3.3, Rails 5.0.1

@philr
Copy link
Member

philr commented Feb 13, 2017

The warning message is coming from Bundler (rubygems/bundler#5003). It is not an error and can be ignored.

When you create a new Ruby on Rails application, a Gemfile is created including the following line that triggers the message:

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

The purpose of this line is to include the tzinfo-data gem in the bundle on Windows to act as a source of time zone data. This gem is unnecessary on Ubuntu (and Unix-based systems in general) because the system includes time zone data that can be read directly by tzinfo.

If you want to get rid of the warning message you can do one of the following:

  1. Remove the platforms option from the gem 'tzinfo-data' line in the Gemfile (and run bundle update). This will cause tzinfo to use tzinfo-data as its data source on all platforms instead of using the system time zone data.
  2. Remove the gem 'tzinfo-data' line from the Gemfile. This will cause tzinfo to always try and use the system time zone data. A TZInfo::DataSourceNotFound exception will be raised if you try and run your app on Windows.
  3. Run bundle lock --add-platform mingw, mswin, x64_mingw, jruby to add mingw, mswin, x64_mingw, and jruby to the list of platforms Bundler will include in the bundle.
  4. Run bundle config --local disable_platform_warnings true to silence the warnings (requires bundler >= 1.17.0). Thanks for @mxhold for this suggestion.

Each of these options would need to be carried out for each Rails application you create.

You can also run bundle config disable_platform_warnings true to disable the warning messages for the current user.

@philr philr closed this as completed Feb 13, 2017
@terracotta210
Copy link
Author

It's good to know that this is not an error, thanks for help.

@cronwel
Copy link

cronwel commented Jul 25, 2017

Thank you philr, I was wondering( and I am a new to programming) how did you learn that? I see lots off folks know great things (like you in this post), but how did you acquire that knowledge? I hope to learn how to learn when it comes to programming. Any advice would be greatly appreciated.

@philr
Copy link
Member

philr commented Jul 26, 2017

@cronwel I'm the author of tzinfo and tzinfo-data, so that's why I know how they can be used. The Gemfile syntax and bundler command are documented on the Bundler documentation site.

pjvv added a commit to sanger-archive/aker-reception-app that referenced this issue Mar 2, 2018
* Don't need tzinfo-data since we don't use Windows:
tzinfo/tzinfo-data#12 (comment)
@lifesucx
Copy link

lifesucx commented Jul 12, 2018

I read philir's answer, and thank you. It is nice to know that it is not an error message, but I am no longer able to (I am sorry if this is worded badly) program in the terminal anymore. My username and the '$' and the name of the directory I am in do not show up. I can type in the line and hit enter, but it is more like I am writing a paper now. No program is executing. I have tried exiting and reopening the terminal and running the program again, but it is always the same output.

update

I closed and reopened the terminal. This time I did not get the notification at the end when the program executed, but I still am having the typing issue.

@wanseanpark
Copy link

I have the pros too, I dont know how to fix it . so sad ...

@mxhold
Copy link

mxhold commented Jan 4, 2019

Just adding that an additional way to silence this warning is by enabling the disable_platform_warnings option for Bundler (available in versions >=1.17.0) by running:

bundle config --local disable_platform_warnings true

This will silence any platform warnings in the context of the current app. If you leave off the --local option, the warnings will be silenced globally for the current machine.

mxhold added a commit to mxhold/wiki that referenced this issue Jan 11, 2019
Rails includes this gem for Windows platforms that don't come bundled
with zoneinfo files. Unfortunately, on non-Windows platforms Bundler
tries to be helpful and issues a warning on every run of `bundle
install` alerting you that this dependency has been skipped:

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

This can be safely ignored as it is intentional to skip this dependency
on unix-like platforms where zoneinfo files are provided by the system.
See:
tzinfo/tzinfo-data#12 (comment)

Fortunately, Bundler has a [configuration
option](https://bundler.io/v1.17/bundle_config.html)
`disable_platform_warnings` for silencing this specific warning.

Given that it's unlikely I'll add any additional platform-specific
dependencies to this project and it's annoying to see this warning every
time I run `bundle install`, I've opted to turn this on for this app
specifically by running `bundle config --local disable_platform_warnings
true` (using `--local` to store the option in this app's
`.bundle/config` rather than globally on this machine since I *would*
want to be warned in other apps).

Since Rails by default ignores the `.bundle` directory (for [good
reason](https://stackoverflow.com/questions/6963496/why-does-rails-ignore-bundle-by-default)),
every developer using a unix-like environment needs to run this command
themselves after cloning, which this commit notes in the README.md.
karimalmur pushed a commit to karimalmur/gatherin that referenced this issue Jan 7, 2020
ruebot added a commit to archivesunleashed/auk that referenced this issue Feb 21, 2020
cisba added a commit to TimeBags/website that referenced this issue Mar 3, 2020
    bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java
    tzinfo/tzinfo-data#12
Ospens pushed a commit to Ospens/i-qoom-gh that referenced this issue Mar 11, 2020
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

The purpose of this line is to include the tzinfo-data gem in the bundle on Windows to act as a source of time zone data. This gem is unnecessary on Ubuntu (and Unix-based systems in general) because the system includes time zone data that can be read directly by tzinfo.

Source: tzinfo/tzinfo-data#12 (comment)
lhm added a commit to CodeforLeipzig/stadtratmonitor that referenced this issue Mar 11, 2020
johnpaulashenfelter added a commit to johnpaulashenfelter/dotfiles that referenced this issue Mar 31, 2020
I was tired of seeing the output about the tzinfo-data file that is
required by Windows in my bundler output. Turns out there's an easy
way to disable it

`bundle config disable_platform_warnings true`

from tzinfo/tzinfo-data#12 (comment)
gavindeas pushed a commit to deasg-comestri/udemy_alpha_blog that referenced this issue Oct 13, 2020
gavindeas pushed a commit to deasg-comestri/udemy_messageme that referenced this issue Oct 20, 2020
nigel-lowry pushed a commit to DFE-Digital/get-help-with-tech that referenced this issue Apr 23, 2021
…will no longer run on Windows (probably acceptable if move to Docker for development). See tzinfo/tzinfo-data#12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants