railsでsqlite3のversionエラーで正常に動作しない件について

AWSの勉強をしていたところ、 rails sを実行するも下記エラーが発生した。 解決方法が判明したのでシェア。

★エラー名

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum required by ActiveRecord). (Gem::LoadError)

★解決方法

  1. GemFileを開く.

    f:id:Appkun:20211005125204p:plain
    GemFile

  2. 以下のように修正する.

変更前 gem 'sqlite3'

変更後 gem 'sqlite3', '~>1.3.0'

f:id:Appkun:20211005125335p:plain
GemFile編集

★原因

Rails 5.0.7.2 では sqlite3 のバージョン 1.4 系に対応していないといったところが原因の模様。

参考URL