This question is related to
ruby-on-rails
ruby
rubygems
If you are using rbenv then make sure that you run the "rbenv rehash" command after you set local or global ruby version. It solved the issue for me.
rbenv rehash
I am on Mac OS Sierra. I had to update /etc/paths
and add /Users/my.username/.rbenv/shims
to the top of the list.
Add the following to your Gemfile
ruby '2.3.0'
If you have already installed 2.2.5 and set as current ruby version, but still showing the same error even if the Ruby version 2.3.0 is not even installed, then just install the bundler.
gem install bundler
and then:
bundle install
Your Gemfile has a line reading
ruby '2.2.5'
Change it to
ruby '2.3.0'
Then run
bundle install
For $
Your Ruby version is 2.3.0, but your Gemfile specified 2.4.1.
Changed 2.4.1 in Gemfile to 2.3.0
Two steps worked for me:
gem install bundler
bundle install --redownload # Forces a redownload of all gems on the gemfile, assigning them to the new bundler
it can also be in your capistrano config (Capfile
):
set :rbenv_ruby, "2.7.1"
I had this problem but I solved it by installing the version of the ruby that is specified in my gem file using the RVM
rvm install (ruby version)
After the installation, I use the following command to use the the version that you installed.
rvm --default use (ruby version)
You have to install bundler by using the following command in order to use the latest version
gem install bundler
After the above steps, you can now run following command to install the gems specified on the gemfile
bundle install
A problem I had on my Mac using rbenv was that when I first set it up, it loaded a bunch of ruby executables in /usr/local/bin - these executables loaded the system ruby, rather than the current version.
If you run
which bundle
And it shows /usr/local/bin/bundle you may have this issue.
Search through /usr/local/bin and delete any files that start with #!/user/bin ruby
Then run
rbenv rehash
Source: Stackoverflow.com