Building a Jekyll static site fails due to Ruby Env versions

Hi folks,

I have a static blog built with Jekyll. I’ve just discovered that builds for it have been failing for a long time because of version issues.

Tl;dr

  • The running version of bundler is throwing a warning:
    6:06:39 PM: Warning: the running version of Bundler (2.0.1) is older than the version that created the lockfile (2.0.2). We suggest you upgrade to the latest version of Bundler by runninggem install bundler.
  • There are incompatible gem versions:
    6:06:43 PM: rubyzip-2.0.0 requires ruby version >= 2.4, which is incompatible with the 6:06:43 PM: current version, ruby 2.3.6p384

What’s the right approach here? Can I update these gems myself in the netlify environment?
Should I downgrade the gems in my project and hope that they work, what if that breaks my site?

Would be great to see if this is just an issue with my site or if others have this problem!

Cheers

Alex

1 Like

Hi, @AlexanderNZ. Welcome to our Netlify community site.

You can set the Ruby version Netlify will use in two different ways, both documented at the URL below:

https://docs.netlify.com/configure-builds/manage-dependencies/#ruby

For the Bundler 2.0.2 issue, it isn’t supported by Netlify at this time and we have an open issue tracking this. The only workaround I know of at this time is to downgrade to Bundler 2.0.1 and regenerate the Gemfile.lock file with this version.

I have cross-linked the issue and this community topic for tracking. We’ll update this topic if/when the issue is resolved.

If other people find this topic, please :heart: it above to indicate your interest in seeing this issue resolved.

If there are other questions about this, @AlexanderNZ, please let us know.

1 Like

Hello,

I was dealing with both of these issues today and was heartened to see that I have a companion moaning in the hospital bed beside me.

Luke: I followed your advice and fixed the Bundler by downgrading to 2.0.1 - worked like a charm.

Now I am dealing with the ruby version situation. I am using windows and installed ruby using the windows ruby installer which yielded me the very specific ruby version 2.6.5p114. So I took your advice and specified the ruby version in a .ruby-version file. When I set .ruby-version to 2.6.2 (to mirror what I found that the Netlify ubuntu server is set up with), the deploy log showed:

"9:02:09 PM: Your Ruby version is 2.6.2, but your Gemfile specified 2.6.5p114

9:02:09 PM: Error during gem install"

(I don’t see any specs regarding ruby or the very specific 2.6.5p114 in my Gemfile… so not sure where it’s getting that. Maybe it’s encoded somehow.)

When I set .ruby-version to 2.6.5 (to mirror my local ruby install), the deploy log showed:

" 9:16:14 PM: Installing gem bundle

9:16:14 PM: /opt/buildhome/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe’: Could not find ‘bundler’ (2.0.1) required by your /opt/build/repo/Gemfile.lock. (Gem::GemNotFoundException)

9:16:14 PM: To update to the latest version installed on your system, run bundle update --bundler.

9:16:14 PM: To install the missing version, run gem install bundler:2.0.1

9:16:14 PM: failed during stage ‘building site’: Build script returned non-zero exit code: 1

9:16:14 PM: from /opt/buildhome/.rvm/rubies/ruby-2.6.5/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path’

9:16:14 PM: from /opt/buildhome/.rvm/rubies/ruby-2.6.5/bin/bundle:30:in `’

9:16:14 PM: from /opt/buildhome/.rvm/rubies/ruby-2.6.5/bin/ruby_executable_hooks:24:in `eval’

9:16:14 PM: from /opt/buildhome/.rvm/rubies/ruby-2.6.5/bin/ruby_executable_hooks:24:in `’

9:16:14 PM: Error during gem install

9:16:14 PM: Error running command: Build script returned non-zero exit code: 1

9:16:14 PM: Failing build: Failed to build site

9:16:14 PM: Finished processing build request in 39.66382542s"

I double-checked after reading this and I still have Bundler v 2.0.1, so not sure why it’s coming up with that message. As for the Ruby versions, it seems like it’s using rvm to download my specific ruby version and it’s gumming up the works. I welcome your take on what’s going on and any ideas as to how to fix this problem and get my site back up.

Thank you for your time and head scratching.

-Reg

When I deploy my Jekyll site, Netlify’s Ubuntu server has to use RVM to run my site’s specific Ruby version. After completing Ruby 2.6.5 install it can’t find Bundler and the build fails:

" 7:11:39 AM: Required ruby-2.6.5 is not installed - installing.

7:11:39 AM: Searching for binary rubies, this might take some time.

7:11:40 AM: Found remote file https://rubies.travis-ci.org/ubuntu/14.04/x86_64/ruby-2.6.5.tar.bz2

7:11:40 AM: Checking requirements for ubuntu.

7:11:41 AM: Requirements installation successful."

" Could not find ‘bundler’ (2.0.1) required by your /opt/build/repo/Gemfile.lock. (Gem::GemNotFoundException)

7:12:03 AM: To update to the latest version installed on your system, run bundle update --bundler.

7:12:03 AM: To install the missing version, run gem install bundler:2.0.1"

I am looking into installing Linux on my Windows laptop or on a flash drive and then installing Ruby, RVM, etc and testing my site from there (since I don’t think RVM works on Windows) - this way I can build my site and Gemfile using one of the Ruby versions already installed on Netlify’s Ubuntu server.

Does this make sense? Is there a faster/ better way? How would you solve this problem?

Thank you.
-Reg

Hmm, that should work as you’re expecting. Can you tell me your site ID so I can look at our internal logs for your builds? You can find the API ID, which is safe to share publicly, on the general settings page for your site in our admin UI.

I am uncomfortable sharing my API key but my site is https://www.clarkiniaastrology.com/

Lemme know if that helps you check under the hood.
Thanks!

Thanks, that works too :slight_smile:

For future reference, your API ID for a site is not usable in any nefarious way. API Tokens for your login (found under https://app.netlify.com/user/applications ARE very sensitive and should never be shared).

I can see from your repo that your Gemfile.lock seems to have a good bundler version at the bottom but I’ll need to do some testing to see if I can generate a more correct Gemfile.lock. (to be clear I can’t see what is wrong, but I think maybe I can recreate one that works better - it is at least worth a try once I get ruby-2.6.5 installed locally). I’ll likely get back to you tomorrow.