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

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

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

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

PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1038閲覧

RailsチュートリアルにてHerokuにプッシュできない問題

jasonwick

総合スコア12

Heroku

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

PostgreSQL

PostgreSQLはオープンソースのオブジェクトリレーショナルデータベース管理システムです。 Oracle Databaseで使われるPL/SQLを参考に実装されたビルトイン言語で、Windows、 Mac、Linux、UNIX、MSなどいくつものプラットフォームに対応しています。

SQL

SQL(Structured Query Language)は、リレーショナルデータベース管理システム (RDBMS)のデータベース言語です。大きく分けて、データ定義言語(DDL)、データ操作言語(DML)、データ制御言語(DCL)の3つで構成されており、プログラム上でSQL文を生成して、RDBMSに命令を出し、RDBに必要なデータを格納できます。また、格納したデータを引き出すことも可能です。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/03/08 04:12

環境

cloud9
ruby 2.6.3
rails 5.1.6

Herokuにプッシュするために以下のコマンドを実行するとエラーが発生してしまいます。

ec2-user:~/environment/toy_app (master) $ git push heroku master Counting objects: 88, done. Compressing objects: 100% (74/74), done. Writing objects: 100% (88/88), 20.94 KiB | 1.23 MiB/s, done. Total 88 (delta 5), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: ! Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used. remote: Detected buildpacks: Ruby,Node.js remote: See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order remote: -----> Ruby app detected remote: -----> Installing bundler 1.17.3 remote: -----> Removing BUNDLED WITH version in the Gemfile.lock ~一部省略~ 0 remote: Fetching actionview 5.1.7 remote: Installing actionview 5.1.7 remote: Fetching actionpack 5.1.7 remote: Installing actionpack 5.1.7 remote: Fetching actioncable 5.1.7 remote: Fetching actionmailer 5.1.7 remote: Fetching railties 5.1.7 remote: Installing actioncable 5.1.7 remote: Installing actionmailer 5.1.7 remote: Installing railties 5.1.7 remote: Fetching sprockets-rails 3.2.1 remote: Installing sprockets-rails 3.2.1 remote: Fetching coffee-rails 4.2.2 remote: Fetching rails 5.1.7 remote: Fetching sass-rails 5.0.7 remote: Installing rails 5.1.7 remote: Installing coffee-rails 4.2.2 remote: Installing sass-rails 5.0.7 remote: Gem::Ext::BuildError: ERROR: Failed to build gem native extension. remote: remote: current directory: remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2/ext/sqlite3 remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/ruby-2.6.5/bin/ruby -I remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/ruby-2.6.5/lib/ruby/2.6.0 -r remote: ./siteconf20200308-254-1suzju9.rb extconf.rb remote: checking for sqlite3.h... no remote: sqlite3.h is missing. Try 'brew install sqlite3', remote: 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' remote: and check your shared library search path (the remote: location where your sqlite3 shared library is located). remote: *** extconf.rb failed *** remote: Could not create Makefile due to some reason, probably lack of necessary remote: libraries and/or headers. Check the mkmf.log file for more details. You may remote: need configuration options. remote: remote: Provided configuration options: remote: --with-opt-dir remote: --without-opt-dir remote: --with-opt-include remote: --without-opt-include=${opt-dir}/include remote: --with-opt-lib remote: --without-opt-lib=${opt-dir}/lib remote: --with-make-prog remote: --without-make-prog remote: --srcdir=. remote: --curdir remote: --ruby=/tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/ruby-2.6.5/bin/$(RUBY_BASE_NAME) remote: --with-sqlcipher remote: --without-sqlcipher remote: --with-sqlite3-config remote: --without-sqlite3-config remote: --with-pkg-config remote: --without-pkg-config remote: --with-sqlcipher remote: --without-sqlcipher remote: --with-sqlite3-dir remote: --without-sqlite3-dir remote: --with-sqlite3-include remote: --without-sqlite3-include=${sqlite3-dir}/include remote: --with-sqlite3-lib remote: --without-sqlite3-lib=${sqlite3-dir}/lib remote: remote: To see why this extension failed to compile, please check the mkmf.log which can remote: be found here: remote: remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/mkmf.log remote: remote: extconf failed, exit code 1 remote: remote: Gem files will remain installed in remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/bundle/ruby/2.6.0/gems/sqlite3-1.4.2 remote: for inspection. remote: Results logged to remote: /tmp/build_37a5f20d089ab3c9564f8c001dadab45/vendor/bundle/ruby/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.2/gem_make.out remote: remote: An error occurred while installing sqlite3 (1.4.2), and Bundler cannot continue. remote: Make sure that `gem install sqlite3 -v '1.4.2' --source 'https://rubygems.org/'` remote: succeeds before bundling. remote: remote: In Gemfile: remote: sqlite3 remote: remote: ! remote: ! Failed to install gems via Bundler. remote: ! Detected sqlite3 gem which is not supported on Heroku: remote: ! https://devcenter.heroku.com/articles/sqlite3 remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to polar-tundra-37862. remote: To https://git.heroku.com/polar-tundra-37862.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/polar-tundra-37862.git' ec2-user:~/environment/toy_app (master) $

以下エラー部分抜粋です。

remote: ! Failed to install gems via Bundler. remote: ! Detected sqlite3 gem which is not supported on Heroku: remote: ! https://devcenter.heroku.com/articles/sqlite3

試したこと

エラー部分メッセージを読む限り、SQLiteが対応してない、ということかと思いましたがRailsチュートリアルの指示通りPostgreSQLと通信ができるようにgemファイルは以下のように編集済みです。

source 'https://rubygems.org' gem 'rails', '5.1.6' gem 'puma', '3.9.1' gem 'sass-rails', '5.0.6' gem 'uglifier', '3.2.0' gem 'coffee-rails', '4.2.2' gem 'jquery-rails', '4.3.1' gem 'turbolinks', '5.0.1' gem 'jbuilder', '2.7.0' group :development, :test do gem 'sqlite3', '1.3.13' gem 'byebug', '9.0.6', platform: :mri end group :development do gem 'web-console', '3.5.1' gem 'listen', '3.1.5' gem 'spring', '2.0.2' gem 'spring-watcher-listen', '2.0.1' end group :production do gem 'pg', '0.20.0' end # Windows環境ではtzinfo-dataというgemを含める必要があります gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

そして以下のコマンドも実行済みです

$ bundle install --without production $ git commit -a -m "Update Gemfile for Heroku" ``` 解決方法のご教授願います。

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

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

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

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

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

guest

回答1

0

自己解決

おそらくですが

$ git commit -a -m "Update Gemfile for Heroku"

を先に実行して

$ bundle install --without production

を後に実行していたのが原因でした。

投稿2020/03/08 05:53

jasonwick

総合スコア12

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問