$ /bin/bundle install --gemfile=ci/Gemfile Gem::InstallError: gettext requires Ruby version >= 2.5.0. An error occurred while installing gettext (3.3.0), and Bundler cannot continue. Make sure that `gem install gettext -v '3.3.0'` succeeds before bundling.
TL;DR, this works – there’s another option which might work, see below, but I can’t be bothered to try. This is two hours of my life I won’t get back.
gem 'gettext', '~> 3.2.0'
Context: CI for checking puppet syntax, running on Centos 7, so ancient Ruby. I’m also partly running Puppet 4 still, so it’s a question of old or older.
$ ruby --version ruby 2.0.0p648 (2015-12-16) [x86_64-linux] $ /opt/puppetlabs/puppet/bin/ruby --version ruby 2.1.9p490 (2016-03-30 revision 54437) [x86_64-linux]
Updating Ruby is not the tactical fix. It’s in the backlog
It worked yesterday. Yay for CI history.
$ /bin/bundle install --gemfile=ci/Gemfile Fetching gem metadata from https://rubygems.org/........... Resolving dependencies... Using rake 12.3.3 Using CFPropertyList 2.2.8 Using facter 2.5.6 Using fast_gettext 1.1.2 Using locale 2.1.2 Using text 1.3.1 Using gettext 3.2.9 Using gettext-setup 0.31 Using hiera 3.6.0 Using json_pure 1.8.6 Using puppet 4.10.12 Using puppet-lint 2.4.2 Using puppet-syntax 2.6.0 Using bundler 1.7.8 Your bundle is complete!
Gettext 3.3.0 came out today, and changes the Ruby dependency from >=0 to >=2.5.0
3.3.0 – January 08, 2020 (281 KB)
3.2.9 – March 05, 2018 (279 KB)
OK, so easy enough – pin to 3.2.x and add it to the ‘fix old ruby’ issue.
I added this:
gem 'gettext', '~> 3.2', '>= 3.2.9'
Why? Because that’s what rubygems.org suggested.
An error occurred while installing gettext (3.3.0), and Bundler cannot continue.
Bundler docs state:
The specifier ~> has a special meaning, best shown by example.
~> 2.0.3 is identical to >= 2.0.3 and < 2.1.
~> 2.1 is identical to >= 2.1 and < 3.0.
gem 'gettext', '~> 3.2, '< 3.3.0'
gem 'gettext', '~> 3.2'
I think something’s wrong with gettext, because from the bundler docs, it can cope with the third tier, and rubygems suggest it in their ‘copy and paste’ gemfile code.
This fixed it:
gem 'gettext', '~> 3.2.0'
This would be nearer to what rubygems.org suggests, and is probably better. But I’m getting the version I expect, so I’m moving on.
gem 'gettext', '~> 3.2.0', '>= 3.2.9'
I don’t pin gem versions unless I need to, it allows my CI to keep on the latest gems until something breaks, and then I have a reason for pinning.
Other things I considered: one of my specified gems had updated, and was mandating 3.3.0. My gemfile is really short; and all the specified gems are the same version on rubygems.org as above; and their dependencies weren’t more specific. I checked these, plus the gems it managed to download.
# gemfile source "https://rubygems.org" gem 'rake', '~> 12.3', '>= 12.3.3' gem "puppet-syntax" gem "puppet-lint" gem "puppet", '4.10.12' # bundle install Resolving dependencies... Using rake 12.3.3 Using CFPropertyList 2.2.8 Using facter 2.5.6 Using fast_gettext 1.1.2 Using locale 2.1.2 Using text 1.3.1 Gem::InstallError: gettext requires Ruby version >= 2.5.0.