Qiita Conference 2025

鹿野壮 (@tonkotsuboy_com)

アウトプットは最強の自己投資 〜発信が人生とキャリアを変えた話〜

6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

RubyのバージョンがHeroku未対応だった

Last updated at Posted at 2019-05-27

はじめに

Rails初心者です。
主にBundlerの扱いにつまずいたのでメモします。
誤った点がありましたら、ご指摘いただけると勉強になります。

補足

Rubyの2.7.0は2019年5月の段階ではまだリリースされていませんでした。
最新バージョンは2.6.3でしたので修正しました。

つまづいたところ

Rubyのバージョン2.7.0を使ってHerokuにデプロイしたところ、
エラーが発生しました。

調べてみると、
Heroku側がまだこのバージョンに対応していないとのことでした。

スクリーンショット 2019-05-26 17.46.55.png

対応しているのが2.6.3までですね。
対応したバージョンが使えるように、Rubyのバージョンを変えていきます。

ちなみに下の「MRI」のところには例として、

・Ruby2.6.14.4を入れたら、2.4.6になるよ
・2.7.6.2を入れたら、2.5.5だよ
・3.0.3を入れたら、2.6.3だよ

と書かれています。

Rubyのバージョンを変更します。
試しに今回は、2.6.0をインストールしてみます。

解決策

①使うRubyのバージョンをインストール

こちらが参考になります。

rbenvでrubyのバージョンを切り替える

②bundlerインストール

$ gem install bundler

③Gemfileに記載

source 'https://rubygems.org'

ruby '2.6.0'

# 省略

④Gemfile.lockファイルがあれば消す

Gemfile.lockbundle installする度に新しく作られるので、
ファイルごと消しておきます。

⑤インストール

$ bundle install

⑥コミット

新しいGemfile.lockが作成されたのを確認し、
コミット→プッシュ

$ git commit
$ git push heroku

無事、Herokuに反映されました!

6
3
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Qiita Conference 2025 will be held!: 4/23(wed) - 4/25(Fri)

Qiita Conference is the largest tech conference in Qiita!

Keynote Speaker

ymrl、Masanobu Naruse, Takeshi Kano, Junichi Ito, uhyo, Hiroshi Tokumaru, MinoDriven, Minorun, Hiroyuki Sakuraba, tenntenn, drken, konifar

View event details
6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?