2013-02-13 57 views
1

我是RoR的初学者,我正在尝试将我的第一个应用程序部署到Heroku。我们正在使用的GitHub存储库,并不断收到试图与部署时的错误:“混帐推Heroku的主人”使用sqlite3错误编译/部署到Heroku

请参阅当我们运行我们得到的消息如下..

$ git push heroku master 
Warning: Permanently added the RSA host key for IP address '50.19.85.156' to the list of  known hosts. 
Counting objects: 69, done. 
Delta compression using up to 4 threads. 
Compressing objects: 100% (55/55), done. 
Writing objects: 100% (69/69), 26.38 KiB, done. 
Total 69 (delta 5), reused 0 (delta 0) 
-----> Ruby/Rails app detected 
-----> Installing dependencies using Bundler version 1.3.0.pre.5 
    Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment 
    Fetching gem metadata from https://rubygems.org/......... 
    Fetching gem metadata from https://rubygems.org/.. 
    Installing rake (10.0.3) 
    Installing i18n (0.6.1) 
    Installing multi_json (1.6.0) 
    Installing activesupport (3.2.11) 
    Installing builder (3.0.4) 
    Installing activemodel (3.2.11) 
    Installing erubis (2.7.0) 
    Installing journey (1.0.4) 
    Installing rack (1.4.5) 
    Installing rack-cache (1.2) 
    Installing rack-test (0.6.2) 
    Installing hike (1.2.1) 
    Installing tilt (1.3.3) 
    Installing sprockets (2.2.2) 
    Installing actionpack (3.2.11) 
    Installing mime-types (1.21) 
    Installing polyglot (0.3.3) 
    Installing treetop (1.4.12) 
    Installing mail (2.4.4) 
    Installing actionmailer (3.2.11) 
    Installing arel (3.0.2) 
    Installing tzinfo (0.3.35) 
    Installing activerecord (3.2.11) 
    Installing activeresource (3.2.11) 
    Installing coffee-script-source (1.4.0) 
    Installing execjs (1.4.0) 
    Installing coffee-script (2.2.0) 
    Installing rack-ssl (1.3.3) 
    Installing json (1.7.7) 
    Installing rdoc (3.12.1) 
    Installing thor (0.17.0) 
    Installing railties (3.2.11) 
    Installing coffee-rails (3.2.2) 
    Installing jquery-rails (2.2.1) 
    Using bundler (1.3.0.pre.5) 
    Installing rails (3.2.11) 
    Installing sass (3.2.5) 
    Installing sass-rails (3.2.6) 
    Installing sqlite3 (1.3.7) 
    Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. 
    /usr/local/bin/ruby extconf.rb 
    checking for sqlite3.h... no 
    sqlite3.h is missing. Try 'port install sqlite3 +universal' 
    or 'yum install sqlite-devel' and check your shared library search path (the 
    location where your sqlite3 shared library is located). 
    *** extconf.rb failed *** 
    Could not create Makefile due to some reason, probably lack of 
    necessary libraries and/or headers. Check the mkmf.log file for more 
    details. You may need configuration options. 
    Provided configuration options: 
    --with-opt-dir 
    --without-opt-dir 
    --with-opt-include 
    --without-opt-include=${opt-dir}/include 
    --with-opt-lib 
    --without-opt-lib=${opt-dir}/lib 
    --with-make-prog 
    --without-make-prog 
    --srcdir=. 
    --curdir 
    --ruby=/usr/local/bin/ruby 
    --with-sqlite3-dir 
    --without-sqlite3-dir 
    --with-sqlite3-include 
    --without-sqlite3-include=${sqlite3-dir}/include 
    --with-sqlite3-lib 
    --without-sqlite3-lib=${sqlite3-dir}/lib 
    --enable-local 
    --disable-local 
    Gem files will remain installed in /tmp/build_1um81jm55kdnc/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.7 for inspection. 
    Results logged to /tmp/build_1um81jm55kdnc/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.7/ext/sqlite3/gem_make.out 
    An error occurred while installing sqlite3 (1.3.7), and Bundler cannot continue. 
    Make sure that `gem install sqlite3 -v '1.3.7'` succeeds before bundling. 
    ! 
    !  Failed to install gems via Bundler. 
    ! 
    !  Heroku push rejected, failed to compile Ruby/rails app 

    To [email protected]:aqueous-tor-8402.git 
    ! [remote rejected] master -> master (pre-receive hook declined) 
    error: failed to push some refs to '[email protected]:aqueous-tor-8402.git' 

我的宝石文件内容如下:

source 'https://rubygems.org' 

gem 'rails', '3.2.11' 

# Bundle edge Rails instead: 
# gem 'rails', :git => 'git://github.com/rails/rails.git' 

gem 'sqlite3' 

gem 'json' 

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

# See https://github.com/sstephenson/execjs#readme for more supported runtimes 
# gem 'therubyracer', :platforms => :ruby 

gem 'uglifier', '>= 1.0.3' 
end 

gem 'jquery-rails' 

# To use ActiveModel has_secure_password 
# gem 'bcrypt-ruby', '~> 3.0.0' 

# To use Jbuilder templates for JSON 
# gem 'jbuilder' 

# Use unicorn as the app server 
# gem 'unicorn' 

# Deploy with Capistrano 
# gem 'capistrano' 

# To use debugger 
# gem 'ruby-debug' 

当我运行“sqlite3的-version我得到:

3.7.12 2012-04-03 19:43:07 86b8481be7e76cccc92d14ce762d21bfb69504af 

当我做“捆绑秀sqlite3的”我得到:

/Library/Ruby/Gems/1.8/gems/sqlite3-1.3.7 

对不起球员,这是我的第一个Rails应用程序,所以我在这个东西是比较新的。

任何帮助,将不胜感激。

更新:这里是Heroku的日志

$ heroku logs 
2013-02-12T22:04:25+00:00 heroku[api]: Enable Logplex by [email protected] 
2013-02-12T22:04:25+00:00 heroku[api]: Release v2 created by [email protected] 
2013-02-12T22:04:47+00:00 heroku[router]: at=info code= desc="Blank app" method=GET   path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait=    connect= service= status=502 bytes= 
2013-02-12T22:04:46+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-12T22:41:52+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T22:42:39+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T22:45:56+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T22:46:30+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T22:59:31+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T22:59:52+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:00:39+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-12T23:00:39+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-12T23:08:25+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:08:50+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:13:09+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:13:45+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:18:14+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:18:41+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:20:03+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:20:34+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:22:39+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:23:05+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:25:50+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:26:37+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:28:52+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:29:20+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:31:20+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:32:01+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:42:41+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:43:08+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:48:22+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:48:47+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-12T23:52:52+00:00 heroku[slugc]: Slug compilation started 
2013-02-12T23:53:16+00:00 heroku[slugc]: Slug compilation failed: failed to compile  Ruby/rails app 
2013-02-13T00:08:04+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-13T00:08:04+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=aqueous-tor-8402.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-13T00:09:49+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/ host=pbarbosa.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-13T00:09:49+00:00 heroku[router]: at=info code= desc="Blank app" method=GET path=/favicon.ico host=pbarbosa.herokuapp.com fwd=99.250.119.144 dyno= queue= wait= connect= service= status=502 bytes= 
2013-02-13T00:09:49+00:00 heroku[router]: at=info code=H16 desc="herokuapp redirect" method=GET path=/ host=pbarbosa.heroku.com fwd="99.250.119.144" dyno= queue= wait= connect= service= status=301 bytes= 
2013-02-13T00:19:18+00:00 heroku[slugc]: Slug compilation started 
2013-02-13T00:19:41+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-13T00:39:17+00:00 heroku[api]: Attach HEROKU_POSTGRESQL_AQUA resource by [email protected] 
2013-02-13T00:39:17+00:00 heroku[api]: Release v3 created by [email protected] 
2013-02-13T01:27:38+00:00 heroku[slugc]: Slug compilation started 
2013-02-13T01:27:59+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-13T01:29:28+00:00 heroku[slugc]: Slug compilation started 
2013-02-13T01:29:52+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-13T01:31:32+00:00 heroku[slugc]: Slug compilation started 
2013-02-13T01:32:01+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 
2013-02-13T01:32:30+00:00 heroku[slugc]: Slug compilation started 
2013-02-13T01:32:55+00:00 heroku[slugc]: Slug compilation failed: failed to compile Ruby/rails app 

回答

7

Heroku的不支持SQLite数据库。您需要在制作中使用postgres。在轨道,切换数据库很简单:

group :production do 
    gem "pg" 
end 

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

更改您的Gemfile类似上面,然后运行bundle,并提交您的更改GemfileGemfile.lock。然后,再次运行git push heroku master

这会让你在开发和测试环境中本地使用sqlite,并根据需要在heroku上使用postgres。

顺便说一下,rails的主要优点之一就是它可以让您轻松切换数据库。在其他框架中,这样做可能会花费你几个小时。

+0

不,我仍然收到同样的错误。 – 2013-02-13 01:07:07

+0

一定要同时提交gemfile和gemfile.lock文件,然后推送,所以Heroku可以接受更改 – catsby 2013-02-13 02:23:53

+0

应该在Rails应用程序中默认提供一个dev db作为DATABASE_URL env var。 – GregB 2013-02-13 02:35:01

0

这里有几件事情,以确保

  1. 评论出来database.yml的生产环境。 heroku已经为你做到了。并像上面说的人,heroku不使用sqlite3,但你可以使用sqlite3进行测试和开发它并没有区别
  2. 在你推之前,确保你迁移你的数据库,如果你对数据库进行了任何更改。做heroku运行rake db:migrate,然后尝试git push heroku master。

希望这能解决它

以供将来参考,张贴Heroku的日志,更容易从看,要解决的问题。

+0

我已经在数据库中注释掉了,执行了rake db:migrate,仍然是同样的错误。我已更新该帖子以包含我的heroku日志。我也在Gemfile中注释了Prod的SQL。请参阅上面的更新后的文章 – 2013-02-13 01:35:14

+0

嗯我不认为它的heroku这个问题,slug编译失败意味着它没有压缩你的rails应用程序。这可能是由许多原因造成的。例如过时的Rails应用程序,或者如果您的资产中有pdf文件或其他东西。我会在您的忽略文件中尝试.slugignore,看看会发生什么 – TakaGoto 2013-02-19 03:40:34