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

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

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

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

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

Ruby on Rails

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

Q&A

解決済

1回答

160閲覧

herokuにデプロイ出来ない問題

hiroki12

総合スコア12

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

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

Ruby on Rails

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

1グッド

1クリップ

投稿2018/12/19 18:05

railsアプリ完成後にherokuでデプロイしようとしましたが、エラーが出てしまいデプロイできません。

参考にしたサイトは以下です。
https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39

私の行った手順は以下です。(参考サイトとほぼ同じです。)

(1)gemfileの設定

gemfileのgem 'sqlite3'をコメントアウトして、group :development, :test do ~~ end内にgem 'sqlite3' を追記。

group :development, :test do gem 'sqlite3' ... end

(2)デプロイする予定であるherokuではPostgreSQL対応なので以下のコード追記

group :production do gem 'pg' end

gemfile全体図

source 'https://rubygems.org' git_source(:github) do |repo_name| repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/") "https://github.com/#{repo_name}.git" end # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.6' # Use sqlite3 as the database for Active Record # gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 3.7' # Use SCSS for stylesheets gem 'sass-rails', '~> 5.0' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'therubyracer', platforms: :ruby # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development # ユーザーの新規登録・ログイン機能を簡単に作成 gem 'devise' # フロントデザインはbootstrap使用 gem 'bootstrap', '~> 4.1.3' # Bootstrapを使うために必要なライブラリ gem 'jquery-rails' # xxxxxxx gem "font-awesome-sass" # ファイルを簡単かつ非常に柔軟にアップロード gem 'carrierwave', '~> 1.0' #画像編集 gem 'mini_magick' group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'sqlite3' gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' end group :development do # Access an IRB console on exception pages or by using <%= console %> anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end group :production do gem 'pg' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

(2)gemfileの設定後にbundle install

shell

1bundle install --without production

(3)config/datebase.ymlの設定

production: <<: *default adapter: postgresql encoding: unicode pool: 5

(4)config/environments/production.rbの設定

config.assets.compile = true

(5)heroku設定後にデプロイ (gitコミット後に)
すると以下のエラーが出てしまい、上手くいきません。

略 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: !

エラー文にはherokuはsqlite3をサポートしてませんよ。と記載されています。
ですが、それを見越してproduction環境ではpostgresqlを使用するように以上のように設定したはずです。
それなのに、なぜ上手く作動しないのかわかりません。

原因を確かめるため、以下のようなテストを行ってみましたが、
問題の解決には至りませんでした。
1、gemfileのBundle installを再度行う

なお、私の環境は以下の通りです。
■ Rails 5.1.6
■ Ruby 2.5.0
■ git 2.17.2
■ heroku/7.19.3 darwin-x64 node-v11.3.0

他に必要な情報があれば、意見ください。

DrqYuto👍を押しています

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

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

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

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

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

hiroki12

2018/12/20 20:44

こちら自己解決しました。 masterブランチに変更箇所をマージ指定なったのが原因です。 ブランチを指定して、再挑戦すると成功しました。 回答ありがとうございました。 https://qiita.com/pugiemonn/items/bd79abbc72c20d8ee9a7
guest

回答1

0

自己解決

masterブランチに変更箇所をマージ指定なったのが原因です。
ブランチを指定して、再挑戦すると成功しました。

https://qiita.com/pugiemonn/items/bd79abbc72c20d8ee9a7

投稿2018/12/30 05:48

hiroki12

総合スコア12

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問