The challenge with working on multiple Ruby on Rails projects is coming across issues conflicting dependencies between projects. One issue I have been having has been with the version of bundler
. One project I am working on depends on bundler v2
and another depends on bundler v1
running on the same Ruby version.
Upgrading bundler
version for the project using bundler v1
is not an option right now and trying to do any bundle installs
can get very annoying since it will be using the wrong version of bundler
for the Gemlock
.
After doing some web searching for a potential solution I found out about this funky annotation for telling bundle
what version of the bundler
gem you would like to use:
bundle _1.13_ install
It's a weird argument but it works. So next time you have a different major bundler
versions across projects try using this.
Top comments (4)
Hi @talk2megooseman :-) I recently had the need to use a specific version of Bundler and found out that the 2 underscores version doesn't work:
Using 1 underscore, before and after the version, works:
Awesome, let me update the article
You're welcome. 🙂🎩
I suppose you could also get rid of:
Or change it to say it's 1 underscore.
I was trying to make
rails new ...
to use an specific version of bundler so the Gemfile.lock would state that version in the end of that file.I tried with:
bundle _x.x.x_ exec rails new ...
But it didn't work, because bundle exec needs a Gemfile to begin with.
What I did was to remove all the bundlers I had installed in the specific Ruby version I wanted to use and keep only the specific version of bundler I wanted.