【问题标题】:heroku push fails with the error "An error occurred while installing sqlite3-ruby (1.2.5)"heroku push 失败并出现错误“安装 sqlite3-ruby (1.2.5) 时发生错误”
【发布时间】:2012-07-27 16:45:21
【问题描述】:

当我这样做时

git push heroku master

我收到以下消息:

       An error occurred while installing sqlite3-ruby (1.2.5), and Bundler cannot continue.
       Make sure that `gem install sqlite3-ruby -v '1.2.5'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app

我已经安装了 libsqlite3-dev、libsqlite3-0、sqlite3,当我运行时:

gem install sqlite3-ruby -v '1.2.5'

按照错误信息提示,安装成功:

Successfully installed sqlite3-ruby-1.2.5
1 gem installed
Installing ri documentation for sqlite3-ruby-1.2.5...
Installing RDoc documentation for sqlite3-ruby-1.2.5...

我不确定可能是什么问题。

我的 Gemfile 是:

source 'http://rubygems.org'
gem 'rails', '3.0.1'
gem 'sqlite3-ruby', '1.2.5',:require => 'sqlite3'

我可以知道是什么问题以及如何解决它吗?

【问题讨论】:

    标签: ruby-on-rails-3 heroku sqlite


    【解决方案1】:

    Heroku 不支持 sqlite3。

    所以您需要将 Gemfile 更改为:

    group :development, :test do
      gem 'sqlite3'
    end
    
    group :production do
      gem 'pg'
    end
    

    然后再次运行bundle install

    【讨论】:

    • 记得在推送到heroku之前提交。
    【解决方案2】:

    很确定你必须在 heroku 中使用 Postgres 数据库

    【讨论】:

      【解决方案3】:

      你不能在 Heroku 上使用 SQLite。根据这篇文章,您需要使用 postgres:https://devcenter.heroku.com/articles/database

      我建议在本地安装 postgres 进行测试和使用;如果您使用的是 OS X,请使用 Homebrew 安装它,否则请尝试 postgres 官方网站上的二进制文件之一。

      【讨论】:

        猜你喜欢
        • 2021-11-08
        • 2015-07-13
        • 2021-07-31
        • 2017-08-28
        • 1970-01-01
        • 2017-11-29
        • 1970-01-01
        • 2016-11-08
        • 1970-01-01
        相关资源
        最近更新 更多