Had an issue with Capistrano refusing to deploy a rails app to an Ubuntu server (with rvm) on AWS.
Got the error: You must use Bundler 2 or greater with this lockfile.
Updating and installing a new bundler did not work. Looking at the gem versions installed it looked fine, but running
bundle --version
``` revealed that the actual binary was another version entirely. It turns out the binary was not being updated with the installation.
This can be done with the
gem pristine
It is useful to know that to find out where specific gem versions are installed you can use
gem list -d 'name-of-gem'
To find general gem paths use
gem environment
Uninstalling a gem cannot always be done if it's marked as default, but this can be circumvented by finding the gem's location and looking for the
specification
default
mv
/usr/local/rvm/rubies/ruby-2.6.3/lib/ruby/gems/2.6.0/specifications/default$ mv bundler-2.0.2.gemspec ..
Installing and uninstalling to the global gemset requires the
gem install
rvmsudo rvm @global do gem install
To install and mark a gem as default use
gem install --default 'name-of-gem'
So the old bundler gem was uninstalled - actually all versions was uninstalled with
rvmsudo rvm @global do gem uninstall bundler
Then the latest version was installed (
rvmsudo rvm @global do gem install bundler -v "2.0.2"
Finally the binary had to be force-updated:
rvmsudo rvm @global do gem pristine --all --only-executables
And voilĂ the
bundle --version
Posted by garac to garac's deck (2019-06-17 20:36)