0
0

More than 3 years have passed since last update.

You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError) というエラーが出た

Posted at

エラーの経緯

Rubyをrbenvにて管理しており、バージョン変更していた中でこのエラーに遭遇。

ターミナル
$ rails s
Traceback (most recent call last):
    5: from bin/rails:3:in `<main>'
    4: from bin/rails:3:in `load'
    3: from /Users/macbook/sample/bin/spring:10:in `<top (required)>'
    2: from /Users/macbook/sample/bin/spring:10:in `new'
    1: from /Users/macbook/.rbenv/versions/2.6.6/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize'
/Users/macbook/.rbenv/versions/2.6.6/lib/ruby/2.6.0/bundler/lockfile_parser.rb:108:in `warn_for_outdated_bundler_version':You must use Bundler 2 or greater with this lockfile. (Bundler::LockfileError)

つまりはGemfile.lockとbundlerのバージョンが異なっており、Gemfile.lockに合わせたbundlerを使う必要があるとのこと。

解決策

ターミナル
#Gemfile.lockでの記載を確認
$ tail -n2 Gemfile.lock
BUNDLED WITH
   2.2.3

#現在のバージョンを確認
$ bundler -v
Bundler version *.*.*(異なるバージョン)

#目的のバージョンをインストール
$ gem install bundler:2.2.3

$ rails s
Could not find i18n-1.8.10 in any of the sources
Run `bundle install` to install missing gems.

#不足しているgemをインストール
$ bundle install

#目的のバージョンがインストールされたことを確認
$ bundler -v
Bundler version 2.2.3

$rails s

無事起動を確認〜

0
0
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
0
0