Search code examples
rubybundler

Why do I get `Could not find 'bundler' (1.17.3)` after upgrading Ruby?


After upgrading from Ruby 2.3 to a newer version and then doing a bundle install I get the error Could not find 'bundler'.

This happens even after doing gem install bundler.


Solution

  • This is because gem install bundler will install the newer 2.x version of bundler and the Gemfile.lock specifies the version of bundler to use at the bottom.

    You can either:

    Install bundler 1.x

    gem install bundler:1.17.3
    

    If this does not work try deleting Gemfile.lock and doing bundle install.

    Upgrade Gemfile.lock to use 2.x

    bundle update --bundler