LoginSignup
1
0

More than 3 years have passed since last update.

Herokuにデプロイできなくて困った話

Posted at

参考にした記事
【解決】Herokuデプロイで躓いた1年前の自分へ

あるアプリを制作し、Herokuにデプロイしようと、

$ git push heroku master

上記のコマンドを実行したところ、

error: failed to push some refs to 'https://git.heroku.com/sleepy-mountain-99332.git'
というエラーが出現。
さらに、heroku上にデータベースを作成しようと

heroku run rails db:migrate

のコマンドを実行するも、bash: rails: command not foundというエラーが出てしまいました。
そこで、これらのエラーメッセージを検索し、対処法を試してみましたが、解決には至りませんでした。

(試したこと)

  • rake assets:precompileをターミナルで入力し、再度Herokuにプッシュ
  • Production.rbにてconfig.assets.compile = falseからtrueに変更 など

しかし、以下のコマンドを実行したら、解決に至りました。

heroku buildpacks:set heroku/ruby && heroku buildpacks:add --index 1 heroku/nodejs && git push heroku master && heroku run rails db:migrate && heroku open

Herokuのbuildpackにrubyパッケージをセットし、nodejsパッケージを追加することが必要でした。
この記事を参考にしました。
【解決】Herokuデプロイで躓いた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