How can I install bundler for a specific ruby version?

I'm creating a rails app and when I try to run rake db:migrate I get this error:


LoadError: cannot load such file -- bundler/setup

I'm using rbenv and ruby version 2.5.1 in a mac with OS Mojave 10.14.4

I've tried installing bundle with gem install bundleAnd it installs it successfully, but then when I try to run bundle install, I get the message:


rbenv: bundle: command not found
The `bundle' command exists in these Ruby versions:
2.6.2

I've tried making sure I'm currently using ruby 2.5.1 checking with ruby -v and also creating an environment variable to define what version to use with:


 export RBENV_VERSION=2.5.1

Also when I type rbenv versions I get:


system
* 2.5.1
2.6.2

Showing I'm using 2.5.1

I suspect there might be two 2.5.1 versions of ruby installed in different places, maybe one with rvm (which I already uninstalled with rmv implode but didn't know I had). Or I might be missing some rbenv configurations.

But nothing seems to work, apparently gem install installs bundle for ruby 2.6.2 only. How can I fix this?

I'm not 100% sure of everything I'm doing, so far I've just followed online tutorials, so please help me understand what's going on and what to do.

Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like