Bundler version mismatch + nokgiri dependency issue failing Jekyll builds

The basics

  • Netlify site: xenodochial-feynman-1c9012
  • Failing build log link: Netlify App

Hi all, I think Netlify’s build process may not be respecting my bundler version and that’s resulting in it identifying a package (nokogiri) as missing that seems to be present.

Pieces of the puzzle:

  • My Gemfile lists 2.1.4 as the version it’s bundled with.
  • Netlify’s build indicates it is using 2.1.4: Using bundler version 2.1.4 from Gemfile.lock (line 24); Successfully installed bundler-2.1.4 (line 25); Using bundler 2.1.4 (line 48)
  • Netlify’s build indicates it is installing nokogiri 1.11.3: Fetching nokogiri 1.11.3 (x86_64-linux) (line 149); Installing nokogiri 1.11.3 (x86_64-linux) (line 150)

The Problem

However, during the Jekyll build command (jekyll build --future true, line 304) , I see:

/opt/buildhome/.rvm/gems/ruby-2.6.2/gems/bundler-2.2.15/lib/bundler/spec_set.rb:89:in block in materialize': Could not find nokogiri-1.11.3 in any of the sources (Bundler::GemNotFound)

This seems to indicate that Netlify’s build is using bundler 2.2.15 rather than 2.1.4 as I would expect, and as its own build seems to expect.

Questions / Asks

  • What is the best way to resolve this error? Do I absolutely have to update my bundler version?
  • In general, do I need to have my site built with a specific version of bundler in order to stay in sync with Netlify requirements? If so, is that listed somewhere, or is there a place I could submit a pull request in order to surface this as a warning?

Thanks in advance for your insight!

I was able to resolve the issue by updating my local bundler to the latest (v2.2.16 at the time of this post):

  • gem install bundler
  • bundle update --bundler

But I’d love to know if there was a way to do it without requiring me to make a change to my dependencies in this way. Is there a reason for the mismatch when a specific version is specified?

1 Like

Hey @SeanKilleen,
I checked our build-image repo to see if I could find the answer to your question… and I found a PR you opened last year! So I’m guessing you know enough to look around that repo as well and that I won’t be telling you anything you don’t already know. It seems like we fixed the issue you’re running into, so perhaps there has been a regression: Use installed bundler version from Gemfile.lock by Benaiah · Pull Request #350 · netlify/build-image · GitHub I’ll link to this thread there and see if we can get some :eyes:

I know it’s been a bit - any updates on this? I just ran into the same issue.

Sorry to double post! Even running the above to update bundler to the latest version didn’t seem to help. I’m still running into issues on that step. Unfortunately, this seems to mean I’m unable to update my website for the time being. Any help would be greatly appreciated!

2:53:45 AM: Executing user command: jekyll build --config _config.yml,_config_live.yml --lsi && jekyll algolia --config _config.yml,_config_live.yml

2:53:46 AM: Activating bundler (2.2.21) failed:

2:53:46 AM: Could not find 'bundler' (2.2.21) required by your /opt/build/repo/Gemfile.lock.

2:53:46 AM: To update to the latest version installed on your system, run `bundle update --bundler`.

2:53:46 AM: To install the missing version, run `gem install bundler:2.2.21`

2:53:46 AM: Checked in 'GEM_PATH=/opt/buildhome/.rvm/gems/ruby-2.6.2:/opt/buildhome/.rvm/rubies/ruby-2.6.2/lib/ruby/gems/2.6.0', execute `gem env` for more information

2:53:46 AM: To install the version of bundler this project requires, run `gem install bundler -v '2.2.21'`

Hey there, @zgk :wave:

It looks like this thread has been quiet for the last week. Are you still encountering this issue? If so, can you share your site name as well as any additional steps you have taken in the past week?

I am not sure we have an update past what @jen provided in April, but I am happy to do some digging for you.

Sorry for the delay!

I found a temporary fix, but the underlying issue still seems present. I found an older support thread that suggested using Bundler 2.0.1, and that seemed to work on my site.

However, it would be great if any version of Bundler was compatible so that I didn’t need to revert versions for the build to succeed!

My site is zak.io.

Glad you’ve got a workaround, @zgk! I’ve asked the devs again in the above PR that Jen linked. We can follow along with their thoughts right there :slight_smile:

Is this why my deploys are failing? i updated the bundler because i am new to all this and i couldnt get my obsidian notes to show up in jekyll feed and after that it fails to build with “materialize” cant find nokogiri in any sources. I tried updating nokogiri locally but git says there’s no difference between repo and local :frowning:

I have 0 experience with bundler, github, netlify, jekyll it’s my first rodeo as they say. Can i commandline downgrade my bundler version?

Hi @bahnegork,

Could you link your deploy log?