Home>

As the title suggests, I'm stuck with an error on heroku run rails db: migrate.

■ Error details
bash: rails: command not found

■ Specs
・ Mac os
・ Rails 6.0.3.4
・ Ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-darwin19]

I set heroku by referring to the following article, but I get an error.
https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39

Thanks for your cooperation.

source'https://rubygems.org'
git_source (: github) {| repo | "https://github.com/#{repo}.git"}
ruby '2.6.6'
gem'rails','~>6.0.3','>= 6.0.3.3'
gem'bcrypt'
gem'puma','~>4.1'
gem'sass-rails','>= 6'
gem'webpacker','~>4.0'
gem'turbolinks','~>5'
gem'jbuilder','~>2.7'
gem'bootsnap','>= 1.4.2', require: false
gem'bootstrap-sass'
gem'devise'
gem'faker'
gem'jquery-rails'
gem'will_paginate'
gem'bootstrap-will_paginate'
gem'carrierwave'
gem "mini_magick"
gem'pry-rails'
group: development,: test do
  gem "factory_bot_rails"
  gem'rubocop-airbnb'
  gem'rails-controller-testing'
  gem'rspec-rails'
  gem'sqlite3'
  gem'byebug', platforms: [: mri,: mingw,: x64_mingw]
end
group: development do
  gem'spring-commands-rspec'
  gem'web-console','>= 3.3.0'
  gem'listen','~>3.2'
  gem'spring'
  gem'spring-watcher-listen','~>2.0.0'
end
group: test do
  gem'webdrivers'
  gem'capybara','>= 2.15'
  gem'selenium-webdriver'
end
group: production do
  gem'pg'
  gem'fog'
end
gem'tzinfo-data'
default:&default
  adapter: sqlite3
  pool:<% = ENV.fetch ("RAILS_MAX_THREADS") {5}%>
  timeout: 10000
development:
<<: * default
  database: db/development.sqlite3
test: test:
<<: * default
  database: db/test.sqlite3
production:
<<: * default
  adapter: postgresql
  encoding: unicode
  pool: 5
  • Answer # 1

    Since it is an error that there is no rails command, I think that the deployment has failed.

    git push heroku master


    I think you are deploying with the above command, so why not check this log?

    For reference, it seems possible that you have pushed a branch other than master to heroku.
    https://qiita.com/chiaki-kjwr/items/811c5e82a8cb2daa590f