Build fails: "Could not find 'bundler'"

Most of Jekyll sites that I manage, and which built great until yesterday, started to fail today without any direct involvement from the repository – only commits that triggered the build were copy related, so hardly a breaking change.

Build reportedly fails due to non-existence of specified bundler.

I have tried several blind deployments with different bundler version, to no avail. The log below so far looks pretty much the same since it started to fail, regardless of bundler version.

Suggestions highly appreciated.

5:04:40 PM: build-image version: c0621868af5001023389eeaa9dbfbbaf313f67e2 (focal)
5:04:40 PM: buildbot version: c0621868af5001023389eeaa9dbfbbaf313f67e2
5:04:40 PM: Fetching cached dependencies
5:04:40 PM: Starting to download cache of 169.3MB
5:04:42 PM: Finished downloading cache in 1.808s
5:04:42 PM: Starting to extract cache
5:04:43 PM: Finished extracting cache in 1.386s
5:04:43 PM: Finished fetching cache in 3.259s
5:04:43 PM: Starting to prepare the repo for build
5:04:43 PM: Preparing Git Reference refs/heads/master
5:04:44 PM: Parsing package.json dependencies
5:04:46 PM: Starting to install dependencies
5:04:46 PM: Attempting Node.js version 'v16.16.0' from .nvmrc
5:04:46 PM: Downloading and installing node v16.16.0...
5:04:46 PM: Downloading https://nodejs.org/dist/v16.16.0/node-v16.16.0-linux-x64.tar.xz...
5:04:47 PM: Computing checksum with sha256sum
5:04:47 PM: Checksums matched!
5:04:49 PM: Now using node v16.16.0 (npm v8.11.0)
5:04:49 PM: Enabling Node.js Corepack
5:04:49 PM: Started restoring cached build plugins
5:04:49 PM: Finished restoring cached build plugins
5:04:49 PM: Started restoring cached corepack dependencies
5:04:49 PM: Finished restoring cached corepack dependencies
5:04:49 PM: Started restoring cached yarn cache
5:04:49 PM: Finished restoring cached yarn cache
5:04:49 PM: Installing Yarn version 1.22.10
5:04:50 PM: Preparing yarn@1.22.10 for immediate activation...
5:04:50 PM: No yarn workspaces detected
5:04:50 PM: Started restoring cached node modules
5:04:50 PM: Finished restoring cached node modules
5:04:50 PM: Installing npm packages using Yarn version 1.22.10
5:04:50 PM: yarn install v1.22.10
5:04:50 PM: warning package.json: No license field
5:04:50 PM: warning No license field
5:04:50 PM: [1/4] Resolving packages...
5:04:50 PM: [2/4] Fetching packages...
5:04:52 PM: info fsevents@2.3.2: The platform "linux" is incompatible with this module.
5:04:52 PM: info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
5:04:52 PM: [3/4] Linking dependencies...
5:04:52 PM: [4/4] Building fresh packages...
5:04:52 PM: Done in 1.94s.
5:04:52 PM: npm packages installed using Yarn
5:04:53 PM: warning package.json: No license field
5:04:53 PM: Python version set to 3.8
5:04:53 PM: Attempting Ruby version 2.7.2, read from environment
5:04:54 PM: Using Ruby version 2.7.2
5:04:54 PM: Using Bundler version 2.3.15 from Gemfile.lock
5:04:54 PM: Successfully installed bundler-2.3.15
5:04:54 PM: 1 gem installed
5:04:54 PM: Started restoring cached ruby gems
5:04:54 PM: Finished restoring cached ruby gems
5:04:54 PM: Installing gem bundle
5:04:55 PM: [DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set --local path '/opt/build/repo/cache/bundle'`, and stop using this flag
5:04:55 PM: [DEPRECATED] The --binstubs option will be removed in favor of `bundle binstubs --all`
5:04:56 PM: Fetching gem metadata from https://rubygems.org/...........
5:04:56 PM: Resolving dependencies...
5:04:56 PM: Using bundler 2.3.15
5:04:56 PM: Fetching colorator 1.1.0
5:04:56 PM: Fetching concurrent-ruby 1.1.10
5:04:56 PM: Fetching eventmachine 1.2.7
5:04:56 PM: Fetching http_parser.rb 0.8.0
5:04:56 PM: Fetching forwardable-extended 2.6.0
5:04:56 PM: Fetching rb-fsevent 0.11.1
5:04:56 PM: Fetching rexml 3.2.5
5:04:56 PM: Fetching liquid 4.0.3
5:04:56 PM: Fetching mercenary 0.4.0
5:04:56 PM: Fetching rouge 3.29.0
5:04:56 PM: Fetching safe_yaml 1.0.5
5:04:56 PM: Fetching unicode-display_width 1.8.0
5:04:56 PM: Fetching jekyll-postcss 0.5.0
5:04:56 PM: Fetching public_suffix 4.0.7
5:04:56 PM: Fetching ffi 1.15.5
5:04:56 PM: Fetching webrick 1.7.0
5:04:56 PM: Installing colorator 1.1.0
5:04:56 PM: Installing mercenary 0.4.0
5:04:56 PM: Installing forwardable-extended 2.6.0
5:04:56 PM: Installing unicode-display_width 1.8.0
5:04:56 PM: Installing rb-fsevent 0.11.1
5:04:56 PM: Installing safe_yaml 1.0.5
5:04:56 PM: Installing jekyll-postcss 0.5.0
5:04:56 PM: Installing liquid 4.0.3
5:04:56 PM: Installing public_suffix 4.0.7
5:04:56 PM: Installing webrick 1.7.0
5:04:56 PM: Installing rexml 3.2.5
5:04:56 PM: Installing eventmachine 1.2.7 with native extensions
5:04:56 PM: Fetching pathutil 0.16.2
5:04:56 PM: Installing http_parser.rb 0.8.0 with native extensions
5:04:56 PM: Installing concurrent-ruby 1.1.10
5:04:56 PM: Installing rouge 3.29.0
5:04:57 PM: Installing ffi 1.15.5 with native extensions
5:04:57 PM: Fetching terminal-table 2.0.0
5:04:57 PM: Installing pathutil 0.16.2
5:04:57 PM: Installing terminal-table 2.0.0
5:04:57 PM: Fetching kramdown 2.4.0
5:04:57 PM: Fetching addressable 2.8.0
5:04:57 PM: Installing kramdown 2.4.0
5:04:57 PM: Installing addressable 2.8.0
5:05:09 PM: Fetching i18n 1.12.0
5:05:09 PM: Fetching kramdown-parser-gfm 1.1.0
5:05:09 PM: Installing kramdown-parser-gfm 1.1.0
5:05:09 PM: Installing i18n 1.12.0
5:05:16 PM: Fetching sassc 2.4.0
5:05:16 PM: Fetching rb-inotify 0.10.1
5:05:16 PM: Fetching em-websocket 0.5.3
5:05:16 PM: Installing rb-inotify 0.10.1
5:05:16 PM: Installing em-websocket 0.5.3
5:05:16 PM: Fetching listen 3.7.1
5:05:16 PM: Installing sassc 2.4.0 with native extensions
5:05:16 PM: Installing listen 3.7.1
5:05:16 PM: Fetching jekyll-watch 2.2.1
5:05:16 PM: Installing jekyll-watch 2.2.1
5:07:43 PM: Fetching jekyll-sass-converter 2.2.0
5:07:43 PM: Installing jekyll-sass-converter 2.2.0
5:07:43 PM: Fetching jekyll 4.2.2
5:07:43 PM: Installing jekyll 4.2.2
5:07:43 PM: Bundle complete! 3 Gemfile dependencies, 30 gems now installed.
5:07:43 PM: Bundled gems are installed into `./cache/bundle`
5:07:43 PM: Gem bundle installed
5:07:44 PM: Started restoring cached go cache
5:07:44 PM: Finished restoring cached go cache
5:07:44 PM: Installing Go version 1.19.5 (requested 1.19.5)
5:07:50 PM: go version go1.19.5 linux/amd64
5:07:50 PM: Using PHP version 8.0
5:07:51 PM: Install dependencies script success
5:07:51 PM: Starting build script
5:07:51 PM: Using stage install dependencies
5:07:51 PM: Detected 1 framework(s)
5:07:51 PM: "jekyll" at version "unknown"
5:07:51 PM: Section completed: initializing
5:07:53 PM: ​
5:07:53 PM:   Netlify Build                                                 
5:07:53 PM: ────────────────────────────────────────────────────────────────
5:07:53 PM: ​
5:07:53 PM: ❯ Version
5:07:53 PM:   @netlify/build 29.5.8
5:07:53 PM: ​
5:07:53 PM: ❯ Flags
5:07:53 PM:   baseRelDir: true
5:07:53 PM:   buildId: 63f4eb96754b7a0008e7cac5
5:07:53 PM:   deployId: 63f4eb96754b7a0008e7cac7
5:07:53 PM: ​
5:07:53 PM: ❯ Current directory
5:07:53 PM:   /opt/build/repo
5:07:53 PM: ​
5:07:53 PM: ❯ Config file
5:07:53 PM:   No config file was defined: using default values.
5:07:53 PM: ​
5:07:53 PM: ❯ Context
5:07:53 PM:   production
5:07:53 PM: ​
5:07:53 PM:   1. Build command from Netlify app                             
5:07:53 PM: ────────────────────────────────────────────────────────────────
5:07:53 PM: ​
5:07:53 PM: $ JEKYLL_ENV=production bundle exec jekyll build
5:07:53 PM: Activating bundler (~> 2.3) failed:
5:07:53 PM: Could not find 'bundler' (2.3.15) required by your /opt/build/repo/Gemfile.lock.
5:07:53 PM: To update to the latest version installed on your system, run `bundle update --bundler`.
5:07:53 PM: To install the missing version, run `gem install bundler:2.3.15`
5:07:53 PM: Checked in 'GEM_PATH=/opt/buildhome/.gem/ruby/2.7.0:/opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0', execute `gem env` for more information
5:07:53 PM: To install the version of bundler this project requires, run `gem install bundler -v '~> 2.3'`
5:07:53 PM: ​
5:07:53 PM:   "build.command" failed                                        
5:07:53 PM: ────────────────────────────────────────────────────────────────
5:07:53 PM: ​
5:07:53 PM:   Error message
5:07:53 PM:   Command failed with exit code 42: JEKYLL_ENV=production bundle exec jekyll build (https://ntl.fyi/exit-code-42)
5:07:53 PM: ​
5:07:53 PM:   Error location
5:07:53 PM:   In Build command from Netlify app:
5:07:54 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
5:07:53 PM:   JEKYLL_ENV=production bundle exec jekyll build
5:07:53 PM: ​
5:07:53 PM:   Resolved config
5:07:53 PM:   build:
5:07:53 PM:     command: JEKYLL_ENV=production bundle exec jekyll build
5:07:53 PM:     commandOrigin: ui
5:07:53 PM:     publish: /opt/build/repo/_site
5:07:53 PM:     publishOrigin: ui
5:07:53 PM: Caching artifacts
5:07:53 PM: Started saving ruby gems
5:07:53 PM: Finished saving ruby gems
5:07:53 PM: Started saving node modules
5:07:53 PM: Finished saving node modules
5:07:53 PM: Started saving build plugins
5:07:53 PM: Finished saving build plugins
5:07:53 PM: Started saving corepack cache
5:07:53 PM: Finished saving corepack cache
5:07:53 PM: Started saving yarn cache
5:07:54 PM: Finished saving yarn cache
5:07:54 PM: Started saving pip cache
5:07:54 PM: Finished saving pip cache
5:07:54 PM: Started saving emacs cask dependencies
5:07:54 PM: Finished saving emacs cask dependencies
5:07:54 PM: Started saving maven dependencies
5:07:54 PM: Finished saving maven dependencies
5:07:54 PM: Started saving boot dependencies
5:07:54 PM: Finished saving boot dependencies
5:07:54 PM: Started saving rust rustup cache
5:07:54 PM: Finished saving rust rustup cache
5:07:54 PM: Started saving go dependencies
5:07:54 PM: Finished saving go dependencies
5:07:54 PM: Build failed due to a user error: Build script returned non-zero exit code: 2
5:07:54 PM: Failing build: Failed to build site
5:07:54 PM: Finished processing build request in 3m14.64s
2 Likes

I have the exact same issue without any code changed.

2 Likes

would you both please share your site name/slugs? @jakubheglas @pfdt

indeed, alshps.netlify.app

sure : pfdt.netlify.app

Hello, same here.

Is this due to netlify changes ?
=> Wondering about the sentence β€œNetlify will migrate all sites to the new experience starting February 20, 2023” on this page : Environment variables overview | Netlify Docs )

I use Github Pages.
I have almost NOT changed my site : just added an article exactely as usal (this still works localy with Jekyll but netlify’s build fails with the same error).
Regards

3 Likes

We are experiencing the same issue as of today 22nd of Feb AEST on desktop-gov-au.netlify.app - any ETA for a fix?

Thanks.

Just also FYI - I migrated environment variables and still am getting same deploy errors. I don’t know where to go from here? I have looked at deployment guides, documentation - needs to be fixed on netlify platform it seems?

1 Like

I have the same error.

A quick hotfix solution:

  • Build your site locally (i.e. bundle exec jekyll build) and commit the static site directory (i.e. tar cvf site.tar.gz _site)
  • Update the deploy settings to tar xvf site.tar.gz
1 Like

check netlify bunlder version with yours. In my case, the project is bundler 1.16.3 and netlify is 2.1.4. As the message says, there is no bundler for that version. Try changing your bundler version to 2.1.4.

The bundler version doesn’t matter. Looking at my deploy logs …

12:34:17 PM: Using Ruby version 2.7.2
12:34:17 PM: Using Bundler version 2.3.8 from Gemfile.lock
12:34:18 PM: Successfully installed bundler-2.3.8
12:34:18 PM: 1 gem installed

then later on …

12:37:02 PM: $ bundle exec jekyll build
12:37:02 PM: Activating bundler (~> 2.3) failed:
12:37:02 PM: Could not find β€˜bundler’ (2.3.8) required by your /opt/build/repo/Gemfile.lock.
12:37:02 PM: To update to the latest version installed on your system, run bundle update --bundler.
12:37:02 PM: To install the missing version, run gem install bundler:2.3.8
12:37:02 PM: Checked in β€˜GEM_PATH=/opt/buildhome/.gem/ruby/2.7.0:/opt/buildhome/.rvm/rubies/ruby-2.7.2/lib/ruby/gems/2.7.0’, execute gem env for more information
12:37:02 PM: To install the version of bundler this project requires, run gem install bundler -v '~> 2.3'

So the build process installs 2.3.8 correctly then can’t find it … ie scripts not picking up paths correctly, or permissions not set correctly etc.

The β€˜GEM_PATH’ in the script looks like it hasn’t added in whatever path is required for the 2.3.8 version. But who knows?

1 Like

Experiencing the same issue.

I have found a couple duplicate threads:

1 Like

Hey @netlify! Your product is on fire, please do something!

3 Likes

Same problem here.

I can’t see how it’s related to the environment variables migration. It just looks like Netlify isn’t installing the same bundler versions as before, which means lots of sites built on Ruby will fail to build (I have two Jekyll sites hosted on Netlify). It was a couple of days ago, so a notification would have been nice.

My error is:

7:09:14 AM: Activating bundler (~> 2.3) failed:
7:09:14 AM: Could not find 'bundler' (2.3.15) required by your /opt/build/repo/Gemfile.lock.
1 Like

I am having a similar issue with a React project and seeing unhelpful failure messages.
In the meantime, I could workaround this issue using netlify deploy --prod and manually deploy as explained here: https://docs.netlify.com/cli/get-started/#production-deploys

Also seeing the same issue with the site that was building fine until recently.

11:49:10 PM: Activating bundler (~> 2.4) failed:
11:49:10 PM: Could not find 'bundler' (2.4.7) required by your /opt/build/repo/Gemfile.lock.

but earlier in the log you can see

11:48:38 PM: Using bundler 2.4.7

I am experiencing the same issue on my site. My previous deploys had the same bundler I have now, I only made a minor change in the displayed text of some files, and all of a sudden, I got this error.

Given how many people are experiencing it, this is likely something on Netlify’s side. Has anyone from the Netlify support team already commented on this?

I have the same issue.

I noticed that the build version has changed from the last successful deploy to the failed one. Successful deploy is using @netlify/build 29.5.7 and failing one is using @netlify/build 29.5.8. The other big difference seems to be that Ruby is not pre-installed on the failing build, and there’s a long series of commands beginning with:

Required ruby-2.6.2 is not installed - installing.

Not sure if any of this is meaningful, just trying to get to the bottom of this!

I’m seeing a very similar issue here, with a site that worked 7 days ago:

12:28:33 PM: $ JEKYLL_ENV=production bundle exec jekyll build -d _site
12:28:33 PM: Activating bundler (~> 2.2) failed:
12:28:33 PM: Could not find 'bundler' (2.2.13) required by your /opt/build/repo/Gemfile.lock.
12:28:33 PM: To update to the latest version installed on your system, run `bundle update --bundler`.
12:28:33 PM: To install the missing version, run `gem install bundler:2.2.13`
12:28:34 PM: Failed during stage 'building site': Build script returned non-zero exit code: 2 (https://ntl.fyi/exit-code-2)
12:28:33 PM: Checked in 'GEM_PATH=/opt/buildhome/.gem/ruby/2.7.0:/opt/buildhome/.rvm/rubies/ruby-2.7.1/lib/ruby/gems/2.7.0', execute `gem env` for more information
12:28:33 PM: To install the version of bundler this project requires, run `gem install bundler -v '~> 2.2'`
12:28:33 PM: ​
12:28:33 PM:   "build.command" failed                                        
12:28:33 PM: ────────────────────────────────────────────────────────────────
12:28:33 PM: ​
12:28:33 PM:   Error message
12:28:33 PM:   Command failed with exit code 42: JEKYLL_ENV=production bundle exec jekyll build -d _site (https://ntl.fyi/exit-code-42)

I’ve tried explicitly adding bundler to the Gemfile and (it then got added to the lock-file too)

But the same error is printed out.

I noticed the Python version is 2.7 in the previous build and now states 3.8. I have Python 3.8 and Bundler version 2.2.13 on my own machine where I can build successfully.

Build image for working build: 5:59:05 PM: build-image version: 01daab3416c9da7032f1dcdb8b1adffdaf5ccb74 (focal)

Build image for broken and now blocked build: 12:25:23 PM: build-image version: c0621868af5001023389eeaa9dbfbbaf313f67e2 (focal)

Same issue here - with a site that last built successfully 2 days ago and now has very similar error logs to those above. The only difference in the site is the addition of a markdown file, no other major site changes. :melting_face: