Help us understand the problem. What is going on with this article?

[エラーメッセージ] can't find gem bundler (>= 0.a) with executable bundler (Gem::GemNotFoundException)

More than 1 year has passed since last update.

 事象

1 Rubyのバージョンを2.5.1に

$ rbenv install 2.5.3
$ rbenv local 2.5.3

2 新しいバージョンに即したbundlerをinstall

$ rbenv exec gem install bundler

3 bundle install

$ bundle install
Traceback (most recent call last):
    2: from /Users/<user名>/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>'
    1: from /Users/<user名>/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/<user名>/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:289:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)

原因

Gemfile.lockに指定されているbundlerのバージョンと、bundlerのバージョンが異なっている

Gemfile.lock
<省略>
BUNDLED WITH
   1.17.3
$ bundler -v
Bundler version 2.0.1

対処法

bundlerのバージョンをGemfile.lockのものと合わせる

$ gem uninstall bundler -v 2.0.1
$ gem install bundler -v 1.17.3
MotohiroSiobara
Spring Boot勉強中
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away