LoginSignup
3
2

More than 5 years have passed since last update.

Railsアプリをherokuにデプロイできない。

Last updated at Posted at 2018-09-23

railsで構築したアプリをherokuへデプロイする際にハマりました。
時間がかかったものの、なんとか解決したので、共有のため投稿します。

事象:マニュアルに従ってもデプロイ不可

下記手順を実行してもデプロイがうまくいかない。

  1. heroku Toolbeltをダウンロード
  2. heroku側にアプリ作成
  3. コマンド実行
    • $ git add .
    • $ git commit -am "make it better"
    • $ git push heroku master
  4. エラー発生
    ・・・
    remote:     from /app/tmp/buildpacks/・・・/bin/support/ruby_compile:15:in `<main>'
    remote:  !     Push rejected, failed to compile Ruby app.
    remote: 
    remote:  !     Push failed
    remote: Verifying deploy...
    remote: 
    remote: !   Push rejected to アプリ名.
    remote: 
    To https://git.heroku.com/アプリ名.git
     ! [remote rejected] master -> master (pre-receive hook declined)
    error: failed to push some refs to 'https://git.heroku.com/アプリ名.git'

原因:assetsファイルのプリコンパイル

assetsのプリコンパイル部分でコケている模様。
ローカルでプリコンパイルし、gitへ追加、その上でpusuすると、無事デプロイされました。

  • $ RAILS_ENV=production bundle exec rake assets:precompile
  • $ git add .
  • $ git commit -am "make it better"
  • $ git push heroku master

 参考:https://stackoverflow.com/questions/36394297/heroku-push-error-could-not-detect-rake-tasks

・・・同じ事象で苦しむ貴方へ届きますよう。。。

3
2
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
3
2