LoginSignup
1
0

More than 1 year has passed since last update.

HerokuでRubyのバージョンを指定する方法

Last updated at Posted at 2021-05-19

Herokuにデプロイしたが、意図してないRubyバージョンになっている

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/ruby
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.6

Ruby Versionが 2.6.6 になっている。
本当は、3.0.1 を使いたい

解決方法

Gemfile
ruby '3.0.1'

の記述を加えて、

console
$ bundle update --ruby

を実行すると、Gemfile.lockが更新される

Gemfile.lock
RUBY VERSION
   ruby 3.0.1p64

もう一度、Herokuにデプロイ

-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/ruby
-----> Ruby app detected
-----> Installing bundler 2.2.16
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.0.1

無事、 3.0.1 になりました。

1
0
0

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
1
0