這是heroku的日志,我以前版本的代碼運行良好,但我更改了一些代碼并出現此錯誤。現在回滾不是解決相同的錯誤...
-----> Building on the Heroku-20 stack
-----> Using buildpack: heroku/php
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
- php (8.1.0)
- ext-mbstring (bundled with php)
- composer (2.1.14)
- apache (2.4.51)
- nginx (1.20.2)
-----> Installing dependencies...
PHP Fatal error: During inheritance of ArrayAccess: Uncaught ErrorException: Return type of Illuminate\Support\Collection::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_3007ab05/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1349
uj5u.com熱心網友回復:
我最近遇到了完全相同的錯誤。我的本地 php 版本是 8.0.13,它作業正常,但是當我將它上傳到 heroku(這里使用的 php 版本是 8.1)時,我收到了錯誤訊息。
為了解決這個問題,我在 composer.json 中將我的 php 版本指定為與我正在使用的完全相同的本地 php 版本,如下所示:
{
"require": {
"php": "8.0.13"
}
}
不要忘記更新composer.lock,然后將其上傳到heroku。Heroku 將使用該確切版本。
我知道不建議為每個https://devcenter.heroku.com/articles/php-support指定確切的版本,但它作為一種解決方法作業正常。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/380318.html
上一篇:Heroku行限制
