【问题标题】:Rails error with git push heroku master errorgit push heroku master错误的Rails错误
【发布时间】:2015-11-12 22:31:30
【问题描述】:

我正在尝试将我的 git 推送到 heroku。为此我使用:

$ git push heroku master

返回:

remote:        --without-sqlite3-lib=${sqlite3-dir}/
remote:        
remote:        
remote:        Gem files will remain installed in /tmp/build_ae596310505cf83afbb45a2986208c96/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11 for inspection.
remote:        Results logged to /tmp/build_ae596310505cf83afbb45a2986208c96/vendor/bundle/ruby/2.0.0/gems/sqlite3-1.3.11/ext/sqlite3/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.11), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling.
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     
remote:  !     Detected sqlite3 gem which is not supported on Heroku.
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote: 
remote:  !     Push rejected, failed to compile Ruby app
remote: 
remote: Verifying deploy...
remote: 
remote: !	Push rejected to glacial-taiga-8832.
remote: 
To https://git.heroku.com/glacial-taiga-8832.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/glacial-taiga-8832.git'

如果我这样做:

$ sudo gem install sqlite3 -v '1.3.11'

它可以工作,但同样的问题。 有人可以帮忙吗?

【问题讨论】:

    标签: ruby-on-rails git heroku sqlite


    【解决方案1】:

    您需要将 sqlite3 gem 移动到 Gemfile 的 development 部分。 Heroku 没有安装 SQLite 数据库。

    例子:

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

    要在 Heroku 上使用数据库,您需要使用 PostgreSQL 数据库(默认情况下)。要使其正常工作,您需要将 pg gem 添加到 production 组中:

    group :production do
      gem 'pg'
    end
    

    另外,您可能需要更新您的database.yml,但我相信 Heroku 只会在您的配置文件中注入他们的数据库连接设置。

    【讨论】:

      猜你喜欢
      • 2016-02-19
      • 2019-10-14
      • 2013-02-03
      • 2016-12-26
      • 1970-01-01
      • 1970-01-01
      • 2014-07-05
      • 1970-01-01
      • 2014-10-26
      相关资源
      最近更新 更多