【问题标题】:How to I make Rails recognise the version of sqlite3 I've added to usr/bin?如何让 Rails 识别我添加到 usr/bin 的 sqlite3 版本?
【发布时间】:2020-01-03 04:29:50
【问题描述】:

我正在尝试让 Rail 6 在 Amazon Linux 上运行,但它没有足够新的 sqlite3 版本

Amazon Linux 上的 sqlite3 最新版本是 3.7.17。我的 Rails 6 版本至少需要 3.8。我通过重命名现有的 sqlite3 二进制文件、用下载的二进制文件替换它并安装一些必需的库来解决它。我现在可以查询它的版本了。

ec2-user:~/environment $ sqlite3 --version                                                             
3.29.0 2019-07-10 17:32:03 fc82b73eaac8b36950e527f12c4b5dc1e147e6f4ad2217ae43ad82882a88bfa6
ec2-user:~/environment $ whereis sqlite3
sqlite3: /usr/bin/sqlite3.7 /usr/bin/sqlite3 /usr/include/sqlite3.h /opt/c9/bin/sqlite3 /usr/share/man/man1/sqlite3.1.gz

在 Rails 服务器运行时,我在浏览器中收到以下错误。

RuntimeError
Your version of SQLite (3.7.17) is too old. Active Record supports SQLite >= 3.8.
Extracted source (around line #336):

334      def check_version # :nodoc:
335        if database_version < "3.8.0"
336          raise "Your version of SQLite (#{database_version}) is too old. Active Record supports SQLite >= 3.8."
337        end
338      end
339

Rails.root: /home/ec2-user/environment/teachify

Application Trace | Framework Trace | Full Trace
activerecord (6.0.0) lib/active_record/connection_adapters/sqlite3_adapter.rb:336:in `check_version' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:880:in `block in new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `tap' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:923:in `checkout_new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:902:in `try_to_checkout_new_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:863:in `acquire_connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:587:in `checkout' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:431:in `connection' 
activerecord (6.0.0) lib/active_record/connection_adapters/abstract/connection_pool.rb:1111:in `retrieve_connection' 
activerecord (6.0.0) lib/active_record/connection_handling.rb:231:in `retrieve_connection' 

(如果需要,还有一些堆栈跟踪)

【问题讨论】:

    标签: ruby-on-rails amazon-linux


    【解决方案1】:

    我相信你也需要

    • 安装更新的 libsqlite3-dev
    • gem 卸载 sqlite3
    • gem 安装 sqlite3

    【讨论】:

      猜你喜欢
      • 2020-01-07
      • 2019-01-23
      • 1970-01-01
      • 2021-11-27
      • 2021-06-22
      • 2017-01-06
      • 1970-01-01
      • 2016-02-02
      • 1970-01-01
      相关资源
      最近更新 更多