2

我完成了关于Rails 和 Bootstrap的railsapps.org教程。我无法将它部署到 Heroku。我的代码与教程完全相同,并且我完全按照“部署”一章中的说明进行操作,但是当我运行时出现以下错误。有什么想法有什么问题吗?git push heroku master

问候,杰夫

$ git push heroku master
Initializing repository, done.
Counting objects: 136, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (113/113), done.
Writing objects: 100% (136/136), 27.95 KiB | 0 bytes/s, done.
Total 136 (delta 35), reused 0 (delta 0)

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.1.1
-----> Installing dependencies using 1.5.2
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Fetching gem metadata from https://rubygems.org/.......
   Fetching additional metadata from https://rubygems.org/..
   Using json (1.8.1)
   Installing minitest (5.3.3)
   Installing rake (10.3.1)
   Installing i18n (0.6.9)
   Installing thread_safe (0.3.3)
   Installing builder (3.2.2)
   Installing mime-types (1.25.1)
   Installing rack (1.5.2)
   Installing erubis (2.7.0)
   Installing polyglot (0.3.4)
   Installing coffee-script-source (1.7.0)
   Installing arel (5.0.1.20140414130214)
   Installing execjs (2.0.2)
   Installing sass (3.2.19)
   Installing multipart-post (2.0.0)
   Installing mini_portile (0.5.3)
   Installing thor (0.19.1)
   Installing oauth (0.4.7)
   Installing multi_xml (0.5.5)
   Using bundler (1.5.2)
   Installing multi_json (1.10.0)
   Installing hike (1.2.3)
   Installing high_voltage (2.1.0)
   Installing tilt (1.4.1)
   Installing tzinfo (1.1.0)
   Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
   /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby extconf.rb
   checking for sqlite3.h... no
   sqlite3.h is missing. Try 'port install sqlite3 +universal',
   'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
   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=/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/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
   extconf failed, exit code 1
   Gem files will remain installed in /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/gems/sqlite3-1.3.9 for inspection.
   Results logged to /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/sqlite3-1.3.9/gem_make.out
   Installing rack-test (0.6.2)
   Installing rdoc (4.1.1)
   Installing treetop (1.4.15)
   An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
   Bundler Output: Fetching gem metadata from https://rubygems.org/.......
   Fetching additional metadata from https://rubygems.org/..
   Using json (1.8.1)
   Installing minitest (5.3.3)
   Installing rake (10.3.1)
   Installing i18n (0.6.9)
   Installing thread_safe (0.3.3)
   Installing builder (3.2.2)
   Installing mime-types (1.25.1)
   Installing rack (1.5.2)
   Installing erubis (2.7.0)
   Installing polyglot (0.3.4)
   Installing coffee-script-source (1.7.0)
   Installing arel (5.0.1.20140414130214)
   Installing execjs (2.0.2)
   Installing sass (3.2.19)
   Installing multipart-post (2.0.0)
   Installing mini_portile (0.5.3)
   Installing thor (0.19.1)
   Installing oauth (0.4.7)
   Installing multi_xml (0.5.5)
   Using bundler (1.5.2)
   Installing multi_json (1.10.0)
   Installing hike (1.2.3)
   Installing high_voltage (2.1.0)
   Installing tilt (1.4.1)
   Installing tzinfo (1.1.0)

   Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

   /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/bin/ruby extconf.rb
   checking for sqlite3.h... no
   sqlite3.h is missing. Try 'port install sqlite3 +universal',
   'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
   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=/tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/ruby-2.1.1/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

   extconf failed, exit code 1

   Gem files will remain installed in /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/gems/sqlite3-1.3.9 for inspection.
   Results logged to /tmp/build_a6d6f6f3-1b58-4344-8c47-ff3f4229b149/vendor/bundle/ruby/2.1.0/extensions/x86_64-linux/2.1.0-static/sqlite3-1.3.9/gem_make.out
   Installing rack-test (0.6.2)
   Installing rdoc (4.1.1)
   Installing treetop (1.4.15)
   An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
   Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
 !
 !     Failed to install gems via Bundler.
 !
 !     Detected sqlite3 gem which is not supported on Heroku.
 !     https://devcenter.heroku.com/articles/sqlite3
 !

 !     Push rejected, failed to compile Ruby app

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

3 回答 3

1

这对其他人来说也是一个问题……包括我自己。我通过确保 sqlite3 仅在开发组中并再次推送到 github 以更新任何更改来解决它。

以下是一些似乎其他人对此问题发表评论的链接:

于 2015-01-27T13:52:59.293 回答
1

根据这本书,你的 Gemfile 应该是这样的:

source 'https://rubygems.org'
ruby '2.1.1'
gem 'rails', '4.1.1'
gem 'sass-rails', '~> 4.0.1'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0',          group: :doc
gem 'spring',        group: :development
gem 'activerecord-tableless'
gem 'bootstrap-sass'
gem 'google_drive'
gem 'high_voltage'
gem 'simple_form'
group :development do
  gem 'sqlite3'
  gem 'better_errors'
  gem 'binding_of_caller', :platforms=>[:mri_21]
  gem 'quiet_assets'
  gem 'rails_layout'
end
group :production do
  gem 'pg'
  gem 'thin'
  gem 'rails_12factor'
end

确保gem 'sqlite3'在开发组中。Heroku 不支持 SQLite,因此您不希望 Heroku 尝试安装它。

于 2014-05-08T19:22:34.427 回答
0

好吧,太奇怪了……我最终破坏了 Heroku 应用程序并重新创建了它。这似乎解决了问题。

于 2014-05-08T20:55:41.993 回答