質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

Q&A

解決済

1回答

1611閲覧

herokuへのデプロイ時のエラー

work1212

総合スコア1

CentOS

CentOSは、主にRed Hat Enterprise Linux(RHEL)をベースにした、フリーのソフトウェアオペレーティングシステムです。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Laravel

LaravelとはTaylor Otwellによって開発された、オープンソースなPHPフレームワークです。Laravelはシンプルで表現的なシンタックスを持ち合わせており、ウェブアプリケーション開発の手助けをしてくれます。

PHP

PHPは、Webサイト構築に特化して開発されたプログラミング言語です。大きな特徴のひとつは、HTMLに直接プログラムを埋め込むことができるという点です。PHPを用いることで、HTMLを動的コンテンツとして出力できます。HTMLがそのままブラウザに表示されるのに対し、PHPプログラムはサーバ側で実行された結果がブラウザに表示されるため、PHPスクリプトは「サーバサイドスクリプト」と呼ばれています。

VirtualBox

VirtualBoxは、現在米オラクル社が開発している、 x86仮想化ソフトウェア・パッケージの一つです。

0グッド

0クリップ

投稿2021/12/17 02:12

前提・実現したいこと

git push heroku master のコマンド実行時にエラーが生じました。
これを解決したいです。

https://www.hypertextcandy.com/laravel-tutorial-deploy-to-heroku
これが参考にしたサイトです。

発生している問題・エラーメッセージ

remote: Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255 remote: ! WARNING: A post-autoload-dump script terminated with an error remote: remote: ! ERROR: Dependency installation failed! remote: ! remote: ! The 'composer install' process failed with an error. The cause remote: ! may be the download or installation of packages, or a pre- or remote: ! post-install hook (e.g. a 'post-install-cmd' item in 'scripts') remote: ! in your 'composer.json'. remote: ! remote: ! Typical error cases are out-of-date or missing parts of code, remote: ! timeouts when making external connections, or memory limits. remote: ! remote: ! Check the above error output closely to determine the cause of remote: ! the problem, ensure the code you're pushing is functioning remote: ! properly, and that all local changes are committed correctly. remote: ! remote: ! For more information on builds for PHP on Heroku, refer to remote: ! https://devcenter.heroku.com/articles/php-support remote: ! remote: ! REMINDER: the following warnings were emitted during the build; remote: ! check the details above, as they may be related to this error: remote: ! - A post-autoload-dump script terminated with an error remote: remote: ! Push rejected, failed to compile PHP app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: 747f19d95313c0e21daaf2ea9a981e2cd65d37ad remote: ! remote: ! We have detected that you have triggered a build from source code with version 747f19d95313c0e21daaf2ea9a981e2cd65d37ad remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to damp-fjord-29872. remote: To https://git.heroku.com/damp-fjord-29872.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/damp-fjord-29872.git'

composer.json

{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": [ "framework", "laravel" ], "license": "MIT", "require": { "php": "^7.2.5|^8.0", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^6.3.1|^7.0.1", "laravel/framework": "^7.29", "laravel/tinker": "^2.5", "laravel/ui": "2.5" }, "require-dev": { "facade/ignition": "^2.0", "fakerphp/faker": "^1.9.1", "mockery/mockery": "^1.3.1", "nunomaduro/collision": "^4.3", "phpunit/phpunit": "^8.5.8|^9.3.3" }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "extra": { "laravel": { "dont-discover": [] } }, "autoload": { "psr-4": { "App\": "app/" }, "classmap": [ "database/seeds", "database/factories" ] }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "minimum-stability": "dev", "prefer-stable": true, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] } }

試したこと

このエラーコードについて調べたらいろんな記事が出てきたんですが、どの記事も解決できなかったので、質問しました。
ためしたサイト
https://stackoverflow.com/questions/64456175/a-post-autoload-dump-script-terminated-with-an-error
https://teratail.com/questions/175530
https://www.webune.com/forums/axpxyr.html
https://teratail.com/questions/175530
https://qiita.com/gotokoki1/items/788f97b18dfe9ab78d1c
https://www.fixes.pub/program/254687.html

補足情報(FW/ツールのバージョンなど)

PHP 7.4.26
laravel 7.30.1
virtualbox バージョン 6.1.28
centos-8
laravel/ui 2.5

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

自己解決

https://devcenter.heroku.com/changelog-items/2304
このサイト見てHerokuのPHPが8.1に上がったせいでpushに失敗するらしく、
PHPのバージョンが8.0以上じゃないといけないと書いてあって、
https://blog.apar.jp/php/14976/
このサイトでバージョンをアップデートしたら、できるようになりました。

投稿2021/12/18 15:19

work1212

総合スコア1

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

work1212

2021/12/18 15:23 編集

composer.jsonのphpの部分も8.0.0にしてコマンドでcomposer updateしました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問