ローカル環境開発で rails s
でエラーが発生しました
Traceback (most recent call last):
5: from bin/rails:3:in `<main>'
4: from bin/rails:3:in `load'
3: from /Users/ユーザー名/projects/アプリ名/bin/spring:10:in `<top (required)>'
2: from /Users/ユーザー名a/projects/アプリ名/bin/spring:10:in `new'
1: from /Users/ユーザー名/.rbenv/versions/2.6.5/lib/ruby/2.6.0/bundler/lockfile_parser.rb:95:in `initialize'
/Users/ユーザー名/.rbenv/versions/2.6.5/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です。
ruby '2.6.5'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.0'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
gem 'rspec-rails', '~> 4.0.0'
gem 'factory_bot_rails'
gem 'faker', '1.9.1'
gem 'pry-rails'
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '>= 3.0.5', '< 3.2'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'devise'
gem 'active_hash'
gem 'mini_magick'
gem 'image_processing', '~> 1.2'
gem 'mini_racer'
gem 'sqlite3', '~> 1.3.6'
"You must use Bundler 2 or greater with this lockfile." このエラー文を翻訳したら "このロックファイルでは、Bundler2以降を使用する必要があります。" と出たのでbundle2以降をインストールする必要があるのでしょうか?
以下の手順を実行しましたがうまくいきませんでした。どなたかご教授お願いします。
rm -rf Gemfile.lock
で gemfile を一度削除rm -rf vendor/bundle
でアプリにインストールされているgemも削除gem install bundler -v '2.1.4'
で bundle をインストールbundle install
を実行
実行環境:
Bundler 2.2.16
ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-darwin20]
bundle exec rails s
と実行した場合はどうなりますか?