【问题标题】:Error: Could not find sqlite3-1.4.0 in any of the sources错误:在任何来源中都找不到 sqlite3-1.4.0
【发布时间】:2019-07-03 19:54:04
【问题描述】:

我目前正在尝试运行 run.rb 文件,但我不断收到 sqlite3 错误。当我输入 bundle install 时,我会收到以下成功消息:

Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Using rake 12.3.2
Using concurrent-ruby 1.1.4
Using i18n 1.5.3
Using minitest 5.11.3
Using thread_safe 0.3.6
Using tzinfo 1.2.5
Using activesupport 5.2.2
Using activemodel 5.2.2
Using arel 9.0.0
Using activerecord 5.2.2
Using bundler 2.0.1
Using coderay 1.1.2
Using equatable 0.5.0
Using method_source 0.9.2
Using mustermann 1.0.3
Using necromancer 0.4.0
Using tty-color 0.4.3
Using pastel 0.7.2
Using pry 0.12.2
Using rack 2.0.6
Using rack-protection 2.0.5
Using require_all 2.0.0
Using tilt 2.0.9
Using sinatra 2.0.5
Using sinatra-activerecord 2.0.13
Using sqlite3 1.4.0
Using timers 4.3.0
Using tty-cursor 0.6.0
Using tty-screen 0.6.5
Using wisper 2.0.0
Using tty-reader 0.5.0
Using tty-prompt 0.18.1
Bundle complete! 7 Gemfile dependencies, 32 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

但是,在运行 ruby app/run.rb 时,我收到以下消息:

Could not find sqlite3-1.4.0 in any of the sources

我已经尝试了几个小时来找出问题所在,我已经卸载并重新安装了 sqlite3,捆绑安装了一百万次,但似乎没有任何效果。任何想法将不胜感激!

【问题讨论】:

  • 您是否有任何理由不使用rails server 来启动服务器,甚至不使用bundle exec rails server 来确保在启动服务器时加载捆绑包?为什么要使用ruby app/run.rb 启动它?
  • 1.4.0 是 5 天前发布的新版本。您是否尝试过使用早期版本?
  • 我尝试过需要早期版本,但我收到相同的 sqlite3 not found 消息:Could not find sqlite3-1.3.13 in any of the sources
  • @ulferts 我目前正在使用 Sinatra
  • 那么,您尝试运行bundle exec ruby run/app.rb 了吗?我假设 gems 安装得很好,但在运行时require 不可用。 bundle exec 应该可以解决这个问题。

标签: ruby sqlite rubygems sinatra bundler


【解决方案1】:

您可以尝试安装libsqlite3-dev 包:

sudo apt-get install -y sqlite3 libsqlite3-dev

gem 'sqlite3', '~> 1.3', '>= 1.3.11'

【讨论】:

    【解决方案2】:

    我遇到了同样的错误并通过以下方式修复了它: 首先,我在 atom 中打开 Gemfile 并将行 gem 'sqlite3' 更改为 gem 'sqlite3' , '~>1.3.6'。 其次,我在终端上运行了gem install sqlite3 -v 1.3.6。 最后,我在终端上运行了bundle install

    这对我有用……祝你好运!

    【讨论】:

      【解决方案3】:

      对于 Rails 5.2.2,您可以通过在 Gemfile 中指定正确版本的 sqlite3 来解决此问题:

      gem 'sqlite3', '~> 1.3.6'
      

      在 Rails 的 5-2-stable 分支中,您可以使用 sqlite 1.4,但在 5.2.2 中会导致错误。

      【讨论】:

      • 如您所见,@AngeloS 使用了 Sinatra。不是 Rails
      • 我没注意到!但是,我认为解决方案是相同的,因为activerecord 的版本是5.2.2。 @AngeloS,让我们知道。
      • 我将 1.3.6 版本添加到 gemfile 中,运行 bundle install 现在看到这个错误:Could not find sqlite3-1.3.13 in any of the sources
      猜你喜欢
      • 1970-01-01
      • 2015-02-25
      • 2014-06-05
      • 1970-01-01
      • 1970-01-01
      • 2016-04-26
      • 1970-01-01
      • 1970-01-01
      • 2018-01-31
      相关资源
      最近更新 更多