2

我无法推送到 Heroku。环顾四周,但没有找到可行的解决方案。似乎缺少一些库,gemfile 在 dev 和 test 下有 sqlite,在 production 下有 pg。下面是推送的结果和sqlite的依赖:

Fetching: sqlite3-1.3.7.gem (100%)
Building native extensions.  This could take a while...
Fetching: sqlite3-ruby-1.3.3.gem (100%)

#######################################################

Hello! The sqlite3-ruby gem has changed it's name to just sqlite3.  Rather than
installing `sqlite3-ruby`, you should install `sqlite3`.  Please update your
dependencies accordingly.

Thanks from the Ruby sqlite3 team!

<3 <3 <3 <3

#######################################################

Successfully installed sqlite3-1.3.7
Successfully installed sqlite3-ruby-1.3.3
2 gems installed
user-macbook:sample_app user$ git push heroku master
Counting objects: 146, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (108/108), done.
Writing objects: 100% (117/117), 17.84 KiB, done.
Total 117 (delta 50), reused 0 (delta 0)
-----> Removing .DS_Store files
-----> 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/..
   Using rake (10.0.3)
   Using i18n (0.6.1)
   Using multi_json (1.5.0)
   Using activesupport (3.2.3)
   Using builder (3.0.4)
   Using activemodel (3.2.3)
   Using erubis (2.7.0)
   Using journey (1.0.4)
   Using rack (1.4.1)
   Using rack-cache (1.2)
   Using rack-test (0.6.2)
   Using hike (1.2.1)
   Using tilt (1.3.3)
   Using sprockets (2.1.3)
   Using actionpack (3.2.3)
   Using mime-types (1.19)
   Using polyglot (0.3.3)
   Using treetop (1.4.12)
   Using mail (2.4.4)
   Using actionmailer (3.2.3)
   Using arel (3.0.2)
   Using tzinfo (0.3.35)
   Using activerecord (3.2.3)
   Using activeresource (3.2.3)
   Installing annotate (2.5.0)
   Installing bcrypt-ruby (3.0.1)
   Installing bootstrap-sass (2.0.0)
   Installing coderay (1.0.8)
   Using coffee-script-source (1.4.0)
   Using execjs (1.4.0)
   Using coffee-script (2.2.0)
   Using rack-ssl (1.3.2)
   Using json (1.7.5)
   Using rdoc (3.12)
   Using thor (0.14.6)
   Using railties (3.2.3)
   Using coffee-rails (3.2.2)
   Using diff-lcs (1.1.3)
   Installing factory_girl (2.3.2)
   Installing factory_girl_rails (1.4.0)
   Installing listen (0.6.0)
   Installing lumberjack (1.0.2)
   Installing method_source (0.8.1)
   Installing slop (3.3.3)
   Installing pry (0.9.10)
   Installing guard (1.6.0)
   Installing guard-rspec (0.5.5)
   Using jquery-rails (2.0.1)
   Using pg (0.12.2)
   Using bundler (1.3.0.pre.5)
   Using rails (3.2.3)
   Using rspec-core (2.9.0)
   Using rspec-expectations (2.9.1)
   Using rspec-mocks (2.9.0)
   Using rspec (2.9.0)
   Using rspec-rails (2.9.0)
   Using sass (3.2.4)
   Using sass-rails (3.2.5)
   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_3vt0kpt7q53ss/vendor/bundle/ruby/1.9.1/gems/sqlite3-1.3.6 for inspection.
   Results logged to /tmp/build_3vt0kpt7q53ss/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:still-woodland-3538.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:still-woodland-3538.git'

sqlite依赖:

Gem sqlite3-1.3.5
  hoe (~> 2.12, development)
  mini_portile (~> 0.2.2, development)
  rake-compiler (~> 0.7.0, development)
  rdoc (~> 3.10, development)

Gem sqlite3-1.3.6
  hoe (~> 3.0, development)
  mini_portile (~> 0.2.2, development)
  rake-compiler (~> 0.7.0, development)
  rdoc (~> 3.10, development)

Gem sqlite3-1.3.7
  hoe (~> 3.4, development)
  mini_portile (~> 0.2.2, development)
  rake-compiler (~> 0.8.2, development)
  rdoc (~> 3.10, development)

宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.0'
gem 'bcrypt-ruby', '3.0.1'


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

group :devlopment, :test do
  gem 'rspec-rails', '2.9.0'
  gem 'guard-rspec', '0.5.5'
  gem 'sqlite3'
  gem 'annotate'
  gem 'factory_girl_rails', '1.4.0'
end


# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.4'
  gem 'coffee-rails', '~> 3.2.2'
  gem 'uglifier', '1.2.3'
  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
 # gem 'therubyracer', :platform => :ruby
   end

   gem 'jquery-rails', '2.0.1'

   # 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-debug19', :require => 'ruby-debug'
group :test do
    gem 'capybara', '1.1.2'
    gem 'rspec-rails', '2.9.0'
    gem 'rb-fsevent'
    gem 'growl', '1.0.3'
    gem 'spork', '0.9.0'
end

group :production do
    gem 'pg'
end
4

2 回答 2

2

问题似乎是你有一个错字:group :devlopment, :test应该是group :development, :test. 您可以看到您在 " devlopment" 组下使用的所有 gem 都已安装在 Heroku 上。

看看更正拼写是否能确保不会尝试在sqlite3生产中使用该宝石(或该组中的任何其他宝石)。

于 2013-01-23T07:08:01.393 回答
0

Heroku 不支持 sqlite3。相反,您应该gem pg改用。

group :production do 
  gem 'pg'
end  

类似于使用 Sqlite3 将 RoR 应用程序部署到 Heroku 失败

于 2013-01-23T05:05:48.840 回答