Search code examples
jekyllbundlernetlify

error with netlify cms deployment says Bundler v2 needed but bundler v2 was used


When trying to deploy a jekyll site stored on github to netlify cms the build process throws this error

10:54:13 AM: Using ruby version 2.3.6
10:54:13 AM: Using PHP version 5.6
10:54:13 AM: Started restoring cached ruby gems
10:54:13 AM: Finished restoring cached ruby gems
10:54:13 AM: Installing gem bundle
10:54:13 AM: You must use Bundler 2 or greater with this lockfile.
10:54:13 AM: Error during gem install
10:54:13 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
10:54:13 AM: Error running command: Build script returned non-zero exit code: 1
10:54:13 AM: Failing build: Failed to build site

Note how it says bundler 2 or greater should be used.

In the GemFile.lock

at the end it shows....

BUNDLED WITH
2.0.1

Anyone any idea what is going on or how I can investigate/resolve this build error given that the site appears to meet the requirement already.

Or is it telling me that I need to configure the netlify build process to use Bundler 2? If so is this possible?


Solution

  • Foiund the answer thanks to this blog. https://stollerys.co.uk/2019/01/12/you-must-use-bundler-2-or-greater-with-this-lockfile

    Netlify build servers don't use V2 of bundler so it barfs.

    Had to downgrade my local version thus:

    gem uninstall bundler
    

    Then install netlify compatible version

    gem install bundler -v 1.17.1
    

    Delete the GemFile.lock

    Regenerate it by running

    bundle install
    

    stage the files to git and then push them to github

    git commit -am "Downgraded bundler for netlify compatibility"
    git push
    

    This triggered the netlify build and it worked a treat.