Heroku试图安装sqlite3 gem,即使它不在Gemfile中

时间:2011-10-16 18:51:02

标签: sqlite heroku ruby-on-rails-3.1 bundler

我正在尝试在Heroku上首次部署Rails 3.1应用程序。我将它设置为Cedar堆栈,删除了sqlite3 gem但是当我将代码推送到Heroku时我得到了这个错误:

  

- - - - >使用Bundler版本1.1.rc安装依赖项          正在运行:捆绑安装 - 无需开发:测试 - 路径供应商/捆绑 - 部署          从http://rubygems.org/获取宝石元数据.......(...)

     

安装导轨(3.1.0)          使用本机扩展安装sqlite3(1.3.4)不幸的是,发生了致命错误。请将此错误报告给   Bundler问题跟踪器   https://github.com/carlhuda/bundler/issues以便我们可以修复它。   谢谢!          /usr/local/lib/ruby/1.9.1/rubygems/installer.rb:483:in在build_extensions中的'rescue in block:'错误:无法构建gem native   延期。 (宝石::安装:: ExtensionBuildError)          / usr / local / bin / ruby​​ extconf.rb          检查sqlite3.h ...没有

我不知道为什么捆绑安装试图安装sqlite3。看看我的Gemfile和Gemfile.lock:

的Gemfile

source 'http://rubygems.org'

gem 'rails', '3.1.0'

gem 'json'
gem 'pg'
gem 'thin'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
#  gem 'sass-rails', "  ~> 3.1.0"
#  gem 'coffee-rails', "~> 3.1.0"
  gem 'uglifier'
end

gem 'jquery-rails'

Gemfile.lock的

GEM   remote: http://rubygems.org/   specs:
    actionmailer (3.1.0)
      actionpack (= 3.1.0)
      mail (~> 2.3.0)
    actionpack (3.1.0)
      activemodel (= 3.1.0)
      activesupport (= 3.1.0)
      builder (~> 3.0.0)
      erubis (~> 2.7.0)
      i18n (~> 0.6)
      rack (~> 1.3.2)
      rack-cache (~> 1.0.3)
      rack-mount (~> 0.8.2)
      rack-test (~> 0.6.1)
      sprockets (~> 2.0.0)
    activemodel (3.1.0)
      activesupport (= 3.1.0)
      bcrypt-ruby (~> 3.0.0)
      builder (~> 3.0.0)
      i18n (~> 0.6)
    activerecord (3.1.0)
      activemodel (= 3.1.0)
      activesupport (= 3.1.0)
      arel (~> 2.2.1)
      tzinfo (~> 0.3.29)
    activeresource (3.1.0)
      activemodel (= 3.1.0)
      activesupport (= 3.1.0)
    activesupport (3.1.0)
      multi_json (~> 1.0)
    arel (2.2.1)
    bcrypt-ruby (3.0.1)
    builder (3.0.0)
    daemons (1.1.4)
    erubis (2.7.0)
    eventmachine (0.12.10)
    execjs (1.2.9)
      multi_json (~> 1.0)
    hike (1.2.1)
    i18n (0.6.0)
    jquery-rails (1.0.14)
      railties (~> 3.0)
      thor (~> 0.14)
    json (1.6.1)
    mail (2.3.0)
      i18n (>= 0.4.0)
      mime-types (~> 1.16)
      treetop (~> 1.4.8)
    mime-types (1.16)
    multi_json (1.0.3)
    pg (0.11.0)
    polyglot (0.3.2)
    rack (1.3.3)
    rack-cache (1.0.3)
      rack (>= 0.4)
    rack-mount (0.8.3)
      rack (>= 1.0.0)
    rack-ssl (1.3.2)
      rack
    rack-test (0.6.1)
      rack (>= 1.0)
    rails (3.1.0)
      actionmailer (= 3.1.0)
      actionpack (= 3.1.0)
      activerecord (= 3.1.0)
      activeresource (= 3.1.0)
      activesupport (= 3.1.0)
      bundler (~> 1.0)
      railties (= 3.1.0)
    railties (3.1.0)
      actionpack (= 3.1.0)
      activesupport (= 3.1.0)
      rack-ssl (~> 1.3.2)
      rake (>= 0.8.7)
      rdoc (~> 3.4)
      thor (~> 0.14.6)
    rake (0.9.2)
    rdoc (3.9.4)
    sprockets (2.0.0)
      hike (~> 1.2)
      rack (~> 1.0)
      tilt (~> 1.1, != 1.3.0)
    thin (1.2.11)
      daemons (>= 1.0.9)
      eventmachine (>= 0.12.6)
      rack (>= 1.0.0)
    thor (0.14.6)
    tilt (1.3.3)
    treetop (1.4.10)
      polyglot
      polyglot (>= 0.3.1)
    tzinfo (0.3.29)
    uglifier (1.0.3)
      execjs (>= 0.3.0)
      multi_json (>= 1.0.2)

PLATFORMS   ruby

DEPENDENCIES   jquery-rails   json   pg   rails (= 3.1.0)   thin   uglifier

我该如何解决?

4 个答案:

答案 0 :(得分:33)

当我遇到问题时,事实证明我忘了在bundle install之后提交我的更改。卫生署! git status应指示gem文件的未分级更改。

答案 1 :(得分:3)

我有同样的问题,zoltarSpeaks的解决方案为我修复了它。我在阅读了这篇文章之后安装了taps gem,表明从本地sqlite3推送到生产postgresql:http://batsov.com/articles/2011/10/30/deploying-rails31-apps-on-celadon-cedar/是必要的。原来我毕竟不需要水龙头宝石,但这显然是问题所在。删除了引用,捆绑更新,所有系统都去了。

答案 2 :(得分:1)

尝试删除Gemfile.lock并运行Bundle Install,commit和push

答案 3 :(得分:0)

简单的解决方案,无需为Heroku卸载sqlite3 gem:

添加到Gemfile:

group :production do
gem 'pg', '0.17.1' #or version of pg you want
gem 'rails_12factor', '0.0.2' #Heroku static assets for image and css

检查,你有:

end 
end

在Gemfile的代码末尾

比保存Gemfile并运行bundle install

$ bundle install --without production

而不是提交

$ git commit -a -m "Update Gemfile.lock for Heroku"

大于

$ git push heroku master

就是这样。你只会得到一些警告,只是为了解决。