LoginSignup
13
8

More than 5 years have passed since last update.

railsのディレクトリでbundleコマンドエラー

Last updated at Posted at 2019-01-04

bundleコマンドでエラーにハマったのでメモ。

症状

特定のディレクトリでbundleコマンドを打つとエラーになる。

$ bundle
Traceback (most recent call last):
    2: from /Users/<username>/.rbenv/versions/2.5.3/bin/bundle:23:in `<main>'
    1: from /Users/<username>/.rbenv/versions/2.5.3/lib/ruby/2.5.0/rubygems.rb:308:in `activate_bin_path'
/Users/<username>/.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があるディレクトリでbundleを打つとエラーになることを確認。
Gemfile.lockを確認すると、bundlerのバージョンが古い。

$ gem list bundler

*** LOCAL GEMS ***

bundler (2.0.1)
Gemfile.lock(修正前)
(前略)

BUNDLED WITH
   1.17.1

対策

Gemfile.lockのbundlerのバージョンを修正したらなおった。

Gemfile.lock(修正後)
(前略)

BUNDLED WITH
   2.0.1
$ bundle -v
Bundler version 2.0.1
13
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
13
8