find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException) ruby ruby

find_spec_for_exe': can't find gem bundler (>= 0.a) (Gem::GemNotFoundException)


The problem in my case is that the Gemfile.lock file had a BUNDLED_WITH version of 1.16.1 and gem install bundler installed version 2.0.1, so there was a version mismatch when looking to right the folder

gem install bundler -v 1.16.1 fixed it

Of course, you can also change your Gemfile.lock's BUNDLED_WITH with last bundler version and use recent software, as Sam3000 suggests


gem update --system

will update the rubygems and will fix the problem.


Update:

According @noraj's answer and @Niels Kristian's comment, the following command should do the job.

gem update --systembundle 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.0Parsing documentation for bundler-1.16.0Installing ri documentation for bundler-1.16.0Done installing documentation for bundler after 7 seconds1 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