0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

LaravelをherokuにDeployする時のエラー

Posted at

LaravelのプロジェクトをHerokuにデプロイするのに、
laradock % git push heroku master
を実行したら下記のエラーが。
Enumerating objects: 12648, done.
Counting objects: 100% (12648/12648), done.
Delta compression using up to 8 threads
Compressing objects: 100% (5024/5024), done.
Writing objects: 100% (12648/12648), 22.10 MiB | 1.06 MiB/s, done.
Total 12648 (delta 7002), reused 12476 (delta 6873), pack-reused 0
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Building on the Heroku-20 stack
remote: -----> Determining which buildpack to use for this app
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to lara-heroku-test3.
remote:
To https://git.heroku.com/lara-heroku-test3.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/lara-heroku-test3.git'

で、エラーメッセージを検索すると
https://qiita.com/taku_hito/items/52c6c52385386544aa62
に同じエラーで悩んだ人が。

今回はphpなので、

laradock % heroku buildpacks:set heroku/php
Buildpack set. Next release on lara-heroku-test3 will use heroku/php.
Run git push heroku main to create a new release using this buildpack.
laradock % heroku buildpacks:add heroku/nodejs
Buildpack added. Next release on lara-heroku-test3 will use:

  1. heroku/php
  2. heroku/nodejs
    Run git push heroku main to create a new release using these buildpacks.
    でbuildpackをセットして、

再度、実行
laradock % git push heroku master
同じエラーでだめ。

laradock % heroku buildpacks:clear
で、デフォルトのビルドパックを元に戻す。

サードパーティのビルドパックを使う設定を試す。
laradock % heroku buildpacks:set https://github.com/some/buildpack.git -a lara-heroku-test3
Buildpack set. Next release on lara-heroku-test3 will use https://github.com/some/buildpack.git.
Run git push heroku main to create a new release using this buildpack.
hnakase@HironoMacBook-Pro laradock % git push heroku master
同じエラーで駄目。

https://mrkmyki.com/heroku%E3%81%AE%E3%83%87%E3%83%97%E3%83%AD%E3%82%A4%E3%81%A7no-default-language-could-be-detected-for-this-app-%E3%81%A8%E5%87%BA%E3%82%8B%E5%A0%B4%E5%90%88%E3%81%AE%E5%AF%BE%E5%87%A6%E3%80%82
に答えが書いてあった。
laravelのrootに
composer.json
というファイルが存在していないと駄目らしい。
laradock % cp workspace/composer.json .
で、rootにファイルをコピーして実行。

すると、
remote: Verifying deploy... done.
To https://git.heroku.com/lara-heroku-test3.git

  • [new branch] master -> master
    laradock %
    で、デプロイが成功!!
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?