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

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

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

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

Ruby on Rails

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

Q&A

2回答

300閲覧

herokuのリモートリポジトリへのpushについて

denki_denki

総合スコア22

Heroku

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

Ruby on Rails

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

0グッド

0クリップ

投稿2019/07/19 08:00

railsとherokuのド素人です。

herokuというリモートリポジトリにpushしようと、次のコマンドを打ちました。

git push heroku master

すると、次の表示となりました。

Enumerating objects: 110, done. Counting objects: 100% (110/110), done. Delta compression using up to 4 threads Compressing objects: 100% (96/96), done. Writing objects: 100% (110/110), 25.93 KiB | 632.00 KiB/s, done. Total 110 (delta 2), 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: -----> Compiling Ruby/Rails remote: Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.3.tgz -s -o - | tar zxf - ' failed on attempt 1 of 3. remote: Command: 'set -o pipefail; curl -L --fail --retry 5 --retry-delay 1 --connect-timeout 3 --max-time 30 https://s3-external-1.amazonaws.com/heroku-buildpack-ruby/heroku-18/ruby-2.3.3.tgz -s -o - | tar zxf - ' failed on attempt 2 of 3. remote: remote: ! remote: ! An error occurred while installing ruby-2.3.3 remote: ! remote: ! This version of Ruby is not available on Heroku-18. The minimum supported version remote: ! of Ruby on the Heroku-18 stack can found at: remote: ! remote: ! https://devcenter.heroku.com/articles/ruby-support#supported-runtimes remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to herokuherokuherokuappapp. remote: To https://git.heroku.com/****.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/****.git'

rubyのバージョンに対して、herokuは対応できませんよ。
だからプッシュは失敗しました。というメッセージだと受け止めています。

しかし、どうしたらいいのかわかりません。
ご教授下さい。よろしくお願いします。

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

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

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

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

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

kazto

2019/07/19 11:09

Gemfileの内容はどのようになっていますか?追記をお願いします。
denki_denki

2019/07/19 11:27

source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.4.5' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.3' # Use sqlite3 as the database for Active Record # gem 'sqlite3' # Use Puma as the app server gem 'puma', '~> 3.11' # 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 'duktape' # 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 ActiveStorage variant # gem 'mini_magick', '~> 4.8' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.1.0', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'sqlite3' end group :production do gem 'pg' end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of chromedriver to run system tests with Chrome gem 'chromedriver-helper' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] rubyのバージョン管理はGemfileで行うとのことでしたが、自分の場合、Gemfileの記述自体を直接編集しました。(リモートリポジトリに対するrubyバージョンの宣言?という認識が働いたためです。) しかし、実際にrubyの適切なバージョンをインストールしなければならないみたいですね。 https://qiita.com/newburu/items/bb31ef2b429b5557b45a 自分の環境はWindowsなのでrbenvは使えないみたいです。 ruby '2.4.5'はrubyinstallerにはなく、 https://www.ruby-lang.org/ja/downloads/ 上記のサイトから入手したファイルの実行の仕方がわからない状態です。
guest

回答2

0

エラーメッセージに書かれている通り、Heroku では以下のバージョンのいずれかしかサポートされません。

2.4.6 : patchlevel 354, Rubygems: 2.6.14.4
2.5.5: patchlevel 157, Rubygems: 2.7.6.2
2.6.3: patchlevel 62, Rubygems: 3.0.3

Supported runtimes
https://devcenter.heroku.com/articles/ruby-support#supported-runtimes

Ruby バージョンは Gemfile で指定できます。
詳細は以下のリンク先を参照してください。

Specifying a Ruby Version
https://devcenter.heroku.com/articles/ruby-versions

投稿2019/07/19 09:16

nskydiving

総合スコア6500

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

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

denki_denki

2019/07/19 10:15

Gemfileにて、ruby '2.3.3' から ruby'2.5.2'(Specifying a Ruby Versionに基づき)変更しました。 次に、git add *** そして、git commit -m heroku メッセージは [master *******] heroku 1 file changed, 1 insertion(+), 1 deletion(-) しかし、git push heroku masterと入力すると、同様のエラーとなります。
nskydiving

2019/07/19 11:42

サポートされているバージョンをよく確認してください。 2.5.2 はサポートされていません。
denki_denki

2019/07/19 11:45

そのようですね。 2.4.5らしいです。
guest

0

以下に似たような事例がたくさんありますが、herokuでサポートされているrubyのバージョンが異なることが原因です。Gemfileなどを確認してみてください。heroku18からはrubyのサポートは2.4.5からになります。

https://qiita.com/newburu/items/bb31ef2b429b5557b45a
https://teratail.com/questions/153766

投稿2019/07/19 09:04

bamboo-nova

総合スコア1408

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

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

denki_denki

2019/07/19 10:32

Gemfile のruby '2.4.5'に変更しました。 git add "Gemfile" と git commit -m heroku を経て git push heroku masterを入力しました。 しかし、 remote: ! An error occurred while installing ruby-2.3.3 だそうです。
bamboo-nova

2019/07/19 12:29

bundle installを行いましたか? また、下の回答をみた限り、2.4.5だとバージョンがサポートされてなさそうなので、別のバージョンを指定してください汗
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

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

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

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

ただいまの回答率
85.50%

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

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

質問する

関連した質問