質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

Q&A

1回答

5735閲覧

初心者です。Herokuでbuildに失敗し続けてしまいます。。

jun__0322

総合スコア12

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Ruby on Rails 4

Ruby on Rails4はRubyによって書かれたオープンソースのウェブフレームワークです。 Ruby on Railsは「設定より規約」の原則に従っており、効率的に作業を行うために再開発を行う必要をなくしてくれます。

0グッド

1クリップ

投稿2016/09/10 12:16

###前提・実現したいこと
はじめてHerokuを使ってrailsの勉強をしています。
buildに失敗しまくって困っております。。。。
助けていただけるとうれしいです。

###発生している問題・エラーメッセージ

-----> Ruby app detected -----> Compiling Ruby/Rails -----> Using Ruby version: ruby-2.2.4 -----> Installing dependencies using bundler 1.11.2 Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Fetching gem metadata from https://rubygems.org/........... Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Installing i18n 0.7.0 Installing json 1.8.3 with native extensions Installing rake 11.2.2 Installing minitest 5.9.0 Installing thread_safe 0.3.5 Installing builder 3.2.2 Installing erubis 2.7.0 Installing mini_portile2 2.1.0 Installing pkg-config 1.1.7 Installing rack 1.6.4 Installing mime-types-data 3.2016.0521 Installing arel 6.0.3 Installing coffee-script-source 1.10.0 Installing execjs 2.7.0 Installing thor 0.19.1 Installing concurrent-ruby 1.0.2 Installing multi_json 1.12.1 Using bundler 1.11.2 Installing pg 0.15.1 with native extensions Installing rails_stdout_logging 0.0.5 Installing rails_serve_static_assets 0.0.5 Installing sass 3.4.22 Installing tilt 2.0.5 Installing turbolinks-source 5.0.0 Installing sqlite3 1.3.11 with native extensions Installing tzinfo 1.2.2 Installing nokogiri 1.6.8 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160910-217-55kifz.rb 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_e1eef8a5f86bfadd3b649493de7ca0df/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME) --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib extconf failed, exit code 1 Gem files will remain installed in /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection. Results logged to /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out Installing rack-test 0.6.3 Installing mime-types 3.1 Installing rdoc 4.2.2 Installing coffee-script 2.4.1 Installing uglifier 3.0.2 Installing sprockets 3.7.0 Installing rails_12factor 0.0.2 Installing turbolinks 5.0.1 Installing activesupport 4.2.1 An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.11'` succeeds before bundling. Bundler Output: Warning: the running version of Bundler is older than the version that created the lockfile. We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. Fetching gem metadata from https://rubygems.org/........... Fetching version metadata from https://rubygems.org/... Fetching dependency metadata from https://rubygems.org/.. Installing i18n 0.7.0 Installing json 1.8.3 with native extensions Installing rake 11.2.2 Installing minitest 5.9.0 Installing thread_safe 0.3.5 Installing builder 3.2.2 Installing erubis 2.7.0 Installing mini_portile2 2.1.0 Installing pkg-config 1.1.7 Installing rack 1.6.4 Installing mime-types-data 3.2016.0521 Installing arel 6.0.3 Installing coffee-script-source 1.10.0 Installing execjs 2.7.0 Installing thor 0.19.1 Installing concurrent-ruby 1.0.2 Installing multi_json 1.12.1 Using bundler 1.11.2 Installing pg 0.15.1 with native extensions Installing rails_stdout_logging 0.0.5 Installing rails_serve_static_assets 0.0.5 Installing sass 3.4.22 Installing tilt 2.0.5 Installing turbolinks-source 5.0.0 Installing sqlite3 1.3.11 with native extensions Installing tzinfo 1.2.2 Installing nokogiri 1.6.8 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/ruby-2.2.4/bin/ruby -r ./siteconf20160910-217-55kifz.rb 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_e1eef8a5f86bfadd3b649493de7ca0df/vendor/ruby-2.2.4/bin/$(RUBY_BASE_NAME) --with-sqlite3-dir --without-sqlite3-dir --with-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib extconf failed, exit code 1 Gem files will remain installed in /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/bundle/ruby/2.2.0/gems/sqlite3-1.3.11 for inspection. Results logged to /tmp/build_e1eef8a5f86bfadd3b649493de7ca0df/vendor/bundle/ruby/2.2.0/extensions/x86_64-linux/2.2.0-static/sqlite3-1.3.11/gem_make.out Installing rack-test 0.6.3 Installing mime-types 3.1 Installing rdoc 4.2.2 Installing coffee-script 2.4.1 Installing uglifier 3.0.2 Installing sprockets 3.7.0 Installing rails_12factor 0.0.2 Installing turbolinks 5.0.1 Installing activesupport 4.2.1 An error occurred while installing sqlite3 (1.3.11), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.3.11'` 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. ! Push failed

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

##原因
エラーメッセージにも「Detected sqlite3 gem which is not supported on Heroku.」とありますが、
herokuではSQLite3に対応していないことが原因です。

##対策
本番環境(heroku)では SQLite3ではなくPostgreSQL(pg)を使用するように設定します。

Railsアプリの「/Gemfile」と「/config/database.yml」を書き換えてから、
「bundle install --without production」を実行してプッシュすれば、buildできるはずです。

##書き換える内容
(参考までに、書き換え前の内容は、Rails4.2.1のものです。)

◆ Gemfile

ruby

1# Use sqlite3 as the database for Active Record 2gem 'sqlite3'

となっている箇所を、

ruby

1# Use sqlite3 as the database for Active Record 2gem 'sqlite3', groups: %w(test development), require: false 3gem 'pg', groups: %w(production), require: false

に書き換えます。

◆ database.yml

yaml

1production: 2 <<: *default 3 database: db/test.sqlite3

となっている箇所を、

yaml

1production: 2 <<: *default 3 adapter: pg 4 database: db/production.pg

に書き換えます。

##参考
http://gam0022.net/blog/2013/09/17/run-rails4-on-heroku/
上記はエラーメッセージで検索すると引っかかるページですが、こちらを参考にしています。

エラーが出たときは、エラーメッセージをまるごと検索すると、
うまくいけばこのような参考記事を見つけられるのでおすすめです!

投稿2016/09/14 04:16

退会済みユーザー

退会済みユーザー

総合スコア0

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだベストアンサーが選ばれていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問