【问题标题】:How to add Sqlite3 gem to the Gemfile?如何将 Sqlite3 gem 添加到 Gemfile?
【发布时间】:2019-09-18 22:48:52
【问题描述】:

我是 Rails 的完全初学者,并且一直在学习教程。 当它说在博客目录中输入“rails server”时,我被卡住了。它指出,“为数据库适配器指定了 'sqlite3',但未加载 gem。将 gem 'sqlite3' 添加到您的 Gemfile(并确保其版本为 ActiveRecord 要求的最低版本)。”

我得到了 ruby​​ 2.4.4、rails 4.2.10、sqlite3(1.4.1、1.4.0)

我已经看到了一些关于同一问题的问题,但解决方案对我不起作用。

我试过了: -gem 安装 sqlite3 -gem 列表 sqlite3 -bundle 添加 sqlite3

有些人在谈论修改 Gemfile.lock,改变 “sqlite3(1.4.1)”到“sqlite3(1.4.1-x64-mingw32)”。这个我也试过了,还是不行

【问题讨论】:

  • 分享你的gemfile

标签: ruby-on-rails ubuntu sqlite


【解决方案1】:

尝试以下步骤

  1. 使用gem uninstall sqlite3卸载gem

  2. 将以下行添加到您的 Gemfile 中

    gem 'sqlite3', git: "https://github.com/larskanis/sqlite3-ruby", branch: "add-gemspec"
    
  3. bundle install

这将解决您的问题。

【讨论】:

    猜你喜欢
    • 2015-05-07
    • 2023-03-07
    • 2019-06-29
    • 2014-04-25
    • 2013-10-16
    • 2020-07-08
    • 1970-01-01
    • 2020-01-17
    • 1970-01-01
    相关资源
    最近更新 更多