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

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

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

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

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Ruby on Rails

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

Q&A

解決済

2回答

1802閲覧

herokuにpushできない

退会済みユーザー

退会済みユーザー

総合スコア0

Heroku

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

MySQL

MySQL(マイエスキューエル)は、TCX DataKonsultAB社などが開発するRDBMS(リレーショナルデータベースの管理システム)です。世界で最も人気の高いシステムで、オープンソースで開発されています。MySQLデータベースサーバは、高速性と信頼性があり、Linux、UNIX、Windowsなどの複数のプラットフォームで動作することができます。

Ruby on Rails

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

0グッド

0クリップ

投稿2017/10/09 13:04

編集2017/10/10 05:06

いつもお世話になっております。

Rails5で作っていたアプリケーションのDBをPostgreSQLからMySQLに変更しpushしたところ、エラーが出ました。
何が原因なのかよくわからないので、ご教授いただければと思います。

$ git push heroku master remote: -----> Ruby app detected remote: -----> Compiling Ruby/Rails remote: -----> Using Ruby version: ruby-2.3.4 remote: -----> Installing dependencies using bundler 1.15.2 remote: Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment remote: Your Gemfile lists the gem mysql2 (~> 0.3.20) more than once. remote: You should probably keep only one of them. remote: While it's not a problem now, it could cause errors if you change the version of one of them later. remote: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: The dependencies in your gemfile changed remote: You have added to the Gemfile: remote: * mysql2 (~> 0.3.20) remote: * mysql2 (~> 0.3.20) remote: You have deleted from the Gemfile: remote: * mysql2 remote: * pg (= 0.18.4) remote: Bundler Output: Your Gemfile lists the gem mysql2 (~> 0.3.20) more than once. remote: You should probably keep only one of them. remote: While it's not a problem now, it could cause errors if you change the version of one of them later. remote: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * mysql2 (~> 0.3.20) remote: * mysql2 (~> 0.3.20) remote: remote: You have deleted from the Gemfile: remote: * mysql2 remote: * pg (= 0.18.4) remote: ! remote: ! Failed to install gems via Bundler. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to xxx. remote: To https://git.heroku.com/xxx.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/xxx.git'

ruby

1#Gemfile 2source 'https://rubygems.org' 3 4gem 'rails', '5.0.0.1' 5gem 'puma', '3.4.0' 6gem 'sass-rails', '5.0.6' 7gem 'uglifier', '3.0.0' 8gem 'coffee-rails', '4.2.1' 9gem 'jquery-rails', '4.1.1' 10gem 'turbolinks', '5.0.1' 11gem 'jbuilder', '2.4.1' 12 13group :development, :test do 14 gem 'byebug', '9.0.0', platform: :mri 15 gem 'mysql2', '~> 0.3.20' 16end 17 18group :development do 19 gem 'web-console', '3.1.1' 20 gem 'listen', '3.0.8' 21 gem 'spring', '1.7.2' 22 gem 'spring-watcher-listen', '2.0.0' 23end 24 25group :production do 26 gem 'mysql2', '~> 0.3.20' 27end

**追記**

You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: The dependencies in your gemfile changed remote: You have added to the Gemfile: remote: * mysql2 (~> 0.3.20) remote: You have deleted from the Gemfile: remote: * mysql2 remote: * pg (= 0.18.4) remote: Bundler Output: You are trying to install in deployment mode after changing remote: your Gemfile. Run `bundle install` elsewhere and add the remote: updated Gemfile.lock to version control. remote: remote: The dependencies in your gemfile changed remote: remote: You have added to the Gemfile: remote: * mysql2 (~> 0.3.20) remote: remote: You have deleted from the Gemfile: remote: * mysql2 remote: * pg (= 0.18.4)

Heroku側でのbundle installは実行しましたが、mysqlではなくpostgresqlが読まれているようです。

どうぞよろしくお願い致します。

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

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

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

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

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

gouf

2017/10/10 04:07

「Your Gemfile lists the gem mysql2 (~> 0.3.20) more than once.」とありますが、Gemfile 中の重複したmysql2 gem の記述をひとつまで削除した場合、変化は見られますか?
退会済みユーザー

退会済みユーザー

2017/10/10 05:03

group内に書いていたものを削除し、jbuilderの下に記述しましたがpushすることができませんでした。
退会済みユーザー

退会済みユーザー

2017/10/10 05:06

すみません、エラーメッセージに変化がありましたので追記しました。
gouf

2017/10/10 06:52

Gemfile を編集後、bundle install は実施されましたか? 依存関係を実際に管理しているGemfile.lock に差分が生じるはずです(その分をコミットしましょう)
退会済みユーザー

退会済みユーザー

2017/10/10 08:34

Gemfile.lockをコミットするのをすっかり忘れていました。どうもありがとうございました。
guest

回答2

0

ベストアンサー

gouf様よりアドバイスいただいた、
Gemfileを編集後、$ bundle installでできたGemfile.lockの差分をコミットしたところ、うまく行きました。

gouf様、CHERRY様、ありがとうございました。

投稿2017/10/10 08:36

退会済みユーザー

退会済みユーザー

総合スコア0

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

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

0

heroku のダッシュボード or コマンドで、ClearDB Add-on を有効にする設定をされていますか?

投稿2017/10/09 13:56

CHERRY

総合スコア25171

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

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

退会済みユーザー

退会済みユーザー

2017/10/10 02:23

>That type of add-on can only exist once per app and it already existsと返ってきたので、設定はできていると思います。また、heroku configでDATABASE_URLとCLEARDATABASE_URLがmysql2になっていることも確認済みです。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.49%

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

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

質問する

関連した質問