0

可能重复:
Heroku、Rails 3 和 sqlite3

我正在使用 Centos 6.3 操作系统,我无法使用 Git 将我的应用程序推送到 heroku

我输入的内容:

git push heroku master

我得到什么:

Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (55/55), done.
Writing objects: 100% (70/70), 86.84 KiB, done.
Total 70 (delta 7), 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 http://rubygems.org/.........
   Fetching gem metadata from http://rubygems.org/..
   Installing rake (10.0.3)
   Installing abstract (1.0.0)
   Installing activesupport (3.0.19)
   Installing builder (2.1.2)
   Installing i18n (0.5.0)
   Installing activemodel (3.0.19)
   Installing erubis (2.6.6)
   Installing rack (1.2.6)
   Installing rack-mount (0.6.14)
   Installing rack-test (0.5.7)
   Installing tzinfo (0.3.35)
   Installing actionpack (3.0.19)
   Installing mime-types (1.19)
   Installing polyglot (0.3.3)
   Installing treetop (1.4.12)
   Installing mail (2.2.19)
   Installing actionmailer (3.0.19)
   Installing arel (2.0.10)
   Installing activerecord (3.0.19)
   Installing activeresource (3.0.19)
   Installing json (1.7.6)
   Using bundler (1.3.0.pre.5)
   Installing rdoc (3.12)
   Installing thor (0.14.6)
   Installing railties (3.0.19)
   Installing rails (3.0.19)
   Installing sqlite3 (1.3.6)
   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_ozcea9mu00be/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
   Results logged to /tmp/build_ozcea9mu00be/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6/ext/sqlite3/gem_make.out
   An error occurred while installing sqlite3 (1.3.6), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.6'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !
 !     Heroku push rejected, failed to compile Ruby/rails app

To git@heroku.com:floating-woodland-1763.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:floating-woodland-1763.git'

自从我检查并仔细检查后,我肯定安装了 sqlite3 版本 1.3.6。我也跑了,得到:

git remote -v
heroku  git@heroku.com:floating-woodland-1763.git (fetch)
heroku  git@heroku.com:floating-woodland-1763.git (push)
origin  git@github.com:(user)/first_app.git (fetch)
origin  git@github.com:(user)/first_app.git (push)

我不知道该怎么办,请帮忙。=)

4

1 回答 1

0

你不能在 Heroku 上使用 sqlite。他们提供 PostgreSQL 的免费开发版本。您可以在他们的 Web 界面或命令行上使用以下命令进行设置:

heroku addons:add heroku-postgresql:dev

当然,你使用这个数据库是有限制的,因为当你的应用程序达到一定大小时 Heroku 开始向你收费。您需要获取插件的登录凭据。最简单的方法是访问 Heroku.com 上的应用程序,单击 PG 插件,然后从下拉列表中选择“Active Record”。这实际上会在config/database.yml文件中显示连接到 Heroku DB 所需的 YAML。

您需要添加gem 'pg'到您的 gemfile 中。Heroku 建议您在开发机器上安装 PG,但如果您不想这样做,您可以在group :production.

底线:你不能在 Heroku 上使用 sqlite。如果这是一个交易破坏者,请查看 Amazon EC2 或其他数千个托管站点中的任何一个。

于 2013-01-12T18:41:12.117 回答