Home > Enterprise >  heroku run rake db:migrate fails to deploy
heroku run rake db:migrate fails to deploy

Time:07-26

I'm trying to deploy my Rails6 app to Heroku
I'm able to successfully build after pushing my app to Heroku but the app immediately crashes.
I just added

group :production do
  gem 'pg', '~> 1.2', '>= 1.2.3'
end

to my Gemfile after developing in sqlite so I figured I'd need to migrate which brings me to my error

peter.walker@MACSB-RJ2CLKF45C friends % heroku run rake db:migrate
Running rake db:migrate on ⬢ ptw-friends... up, run.5761 (Free) Your Ruby version is 2.7.0, but your Gemfile specified 2.6.10

I'm not sure why I'm being told my Ruby version is 2.7.0.
My Gemfile has ruby '2.6.10',
my Gemfile.lock has RUBY VERSION ruby 2.6.10p210,
and my $ ruby -v returns ruby 2.6.10p210 (2022-04-12 revision 67958) [arm64-darwin21]

Could it be from adding

  "scripts": {
    "start": "rails s"
  },

to my package.json?
Could I not be specifying the Ruby version in Procfile?

The full error is here along with my repo https://github.com/petertimwalker/friends/issues/1

CodePudding user response:

Heroku doesn't support all Ruby versions. When a Ruby version reaches end-of-life and is not maintained anymore then Heroku stops supporting it.

Ruby 2.6 reached end-of-life December last year.

Therefore you need to update your application and your local environment to at least 2.7 when you still want to be able to deploy on Heroku.

Please see the list of Ruby versions supported by Heroku.

CodePudding user response:

install ruby version 2.6.10 and use that version in local if you using rvm check your current version with rvm list and install ruby 2.6.10 with rvm install 2.6.10 then use command rvm use 2.6.10

  • Related