侧边栏壁纸
  • 累计撰写 218 篇文章
  • 累计创建 59 个标签
  • 累计收到 5 条评论

Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8.

barwe
2023-02-07 / 0 评论 / 0 点赞 / 720 阅读 / 623 字
温馨提示:
本文最后更新于 2023-02-07,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

Rails 集成 SQLite3 时,如果只是简单的用 gem 或者 bundler 安装 sqlite3 很可能出现下面这个问题:

Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8.

检查系统 sqlite3 版本时也是完全没问题的:

$ sqlite3 --version
3.40.1 2022-12-28 14:03:47 df5c253c0b3dd24916e4ec7cf77d3db5294cc9fd45ae7b9c5e82ad8197f38a24

原因是我们使用 bundler 安装 sqlite3 时使用的是 Rails 默认提供的 SQLite3,因此我们需要在安装时换成自己安装的 SQLite3 库。

解决办法参考 https://stackoverflow.com/questions/58073262/version-of-sqlite-3-7-17-is-too-old-active-record-supports-sqlite-3-8?noredirect=1

首先下源码,编译安装。

然后重装 sqlite3 gem 包:

bundle config build.sqlite3 --with-sqlite3-include=/opt/sqlite/sqlite3/include --with-sqlite3-lib=/opt/sqlite/sqlite3/lib

bundle install

over

0

评论区