I used sudo bundle install
and that might be the cause of the issue?
Now I have:
gem -v
2.6.14ruby -v
Adding to the many answers, my problem stemmed from wanting to use the docker's ruby as a base, but then using rbenv on top. This screws up a lot of things.
I fixed it in this case by:
unset GEM_HOME
unset BUNDLE_PATH
After that, rbenv worked fine. Not sure how those env vars were getting loaded in the first place...
I downgraded ruby from 2.5.x to 2.4.x in my particular case.
I had to do rake clean --force
. Then did gem install rake
and so forth.
According @noraj's answer and @Niels Kristian's comment, the following command should do the job.
gem update --system
bundle install
I wrote this in case someone gets into an issue like mine.
gem install bundler
shows that everythings installs well.
Fetching: bundler-1.16.0.gem (100%)
Successfully installed bundler-1.16.0
Parsing documentation for bundler-1.16.0
Installing ri documentation for bundler-1.16.0
Done installing documentation for bundler after 7 seconds
1 gem installed
When I typed bundle
there was an error:
/Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in `load': cannot load such file -- /Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/bundler-1.16.0/exe/bundle (LoadError)
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/bundle:23:in `<main>'
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/nikkov/.rvm/gems/ruby-2.4.0/bin/ruby_executable_hooks:15:in `<main>'
And in the folder /Users/nikkov/.rvm/rubies/ruby-2.4.0/lib/ruby/gems/2.4.0/gems/
there wasn't a bundler-1.16.0
folder.
I fixed this with sudo gem install bundler
In my case the above suggestions did not work for me. Mine was little different scenario.
When i tried installing bundler
using gem install bundler
.. But i was getting
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.3.0 directory.
then i tried using sudo gem install bundler
then i was getting
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
then i tried with sudo gem install bundler -n /usr/local/bin
( Just /usr/bin
dint work in my case ).
And then successfully installed bundler
EDIT: I use MacOS, maybe /usr/bin
din't work for me for that reason (https://stackoverflow.com/a/34989655/3786657 comment )
I had the same issue today. I solve this problem by removing any PATH
in .bashrc
for older rvm
.