如何在 Mac 上使用 Sqlite3 运行 rails?我收到“gem 未加载”但它已包含在 Gemfile 中

How can I run rails with Sqlite3 on Mac? I'm getting " gem is not loaded" but it was included on Gemfile

我想使用 Sqlite 创建一个新的 rails 应用程序,但我发现了一些问题。 我正在使用 Rails 5.0.7.1 正确安装并且 gem 'sqlite3' 包含在我的 Gemfile 中。我系统(Mac OS)中sqlite3的版本是3.24.0 2018-06-04 14:10:15 95fbac39baaab1c3a84fdfc82ccb7f42398b2e92f18a2a57bce1d4a713cbaapl

运行 rails 服务器并访问我的 localhost:3000 给我错误:

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 已安装 运行 捆绑安装,我可以在我的 Gemfile.lock sqlite3 (1.4.0)

中看到它

我不知道是什么问题。任何人都可以帮助我吗? 谢谢!

我在旧版本 ruby/rails(2.5/5.2) 上遇到了 sqlite3(1.4.0) 的问题。您可以尝试在 Gemfile 和 运行 包中再次指定较低版本的 sqlite3。

 gem 'sqlite3', '~> 1.3.13'

可能与 Ruby on Rails - "Add 'gem sqlite3'' to your Gemfile"

重复