Fixing the error: can't find gem bundler

Photo by Ryan Stone on Unsplash

Fixing the error: can't find gem bundler

Greetings friends!

If you are in a rails project and need to install the gem bundler, but you got this error:

can't find gem bundler (>= 0.a)

The best way to install the gem bundler and avoid or fix this error is to install the bundler gem by getting the specific version contained in the Gemfile.lock with the command below:

gem install bundler -v "$(grep -A 1 "BUNDLED WITH" Gemfile.lock | tail -n 1)"

I hope that this content helps you! See you in the next article!