繁体   English   中英

在 Heroku 上部署 Laravel 项目时,出现错误

[英]When Deploying a Laravel project on Heroku, I got errors

我是 heroku 的新手,在尝试部署 Laravel 应用程序时遇到了这些错误。 我也在 procfile 上添加了 web: vendor/bin/heroku-php-apache2 public/ 。

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
remote:        Deprecation Notice: Return type ofIlluminate\Container\Container::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_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php:1231
remote:        Deprecation Notice: Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php:1242
remote:        Deprecation Notice: Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php:1254
remote:        Deprecation Notice: Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php:1267
remote:        > @php artisan package:discover --ansi
remote:        PHP Deprecated:  Return type of Illuminate\Container\Container::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_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231
remote:        PHP Deprecated:  Return type of Illuminate\Container\Container::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1242
remote:        PHP Deprecated:  Return type of Illuminate\Container\Container::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1254
remote:        PHP Deprecated:  Return type of Illuminate\Container\Container::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1267
remote:        PHP Deprecated:  Return type of Illuminate\Config\Repository::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_275de9ef/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 141
remote:        PHP Deprecated:  Return type of Illuminate\Config\Repository::offsetGet($key) should either be compatible with ArrayAccess::offsetGet(mixed $offset): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 152
remote:        PHP Deprecated:  Return type of Illuminate\Config\Repository::offsetSet($key, $value) should either be compatible with ArrayAccess::offsetSet(mixed $offset, mixed $value): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 164
remote:        PHP Deprecated:  Return type of Illuminate\Config\Repository::offsetUnset($key) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Config/Repository.php on line 175
remote:        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_275de9ef/vendor/laravel/framework/src/Illuminate/Support/Collection.php:1277
remote:        Stack trace:
remote:        #0 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Support/Collection.php(11): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
remote:        #1 /tmp/build_275de9ef/vendor/composer/ClassLoader.php(571): include('...')
remote:        #2 /tmp/build_275de9ef/vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile()
remote:        #3 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Support/helpers.php(109): Composer\Autoload\ClassLoader->loadClass()
remote:        #4 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(130): collect()
remote:        #5 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(106): Illuminate\Foundation\PackageManifest->build()
remote:        #6 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(89): Illuminate\Foundation\PackageManifest->getManifest()
remote:        #7 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/PackageManifest.php(78): Illuminate\Foundation\PackageManifest->config()
remote:        #8 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/RegisterFacades.php(26): Illuminate\Foundation\PackageManifest->aliases()
remote:        #9 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(219): Illuminate\Foundation\Bootstrap\RegisterFacades->bootstrap()
remote:        #10 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(320): Illuminate\Foundation\Application->bootstrapWith()
remote:        #11 /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Foundation\Console\Kernel->bootstrap()
remote:        #12 /tmp/build_275de9ef/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
remote:        #13 {main} in /tmp/build_275de9ef/vendor/laravel/framework/src/Illuminate/Support/Collection.php on line 11
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: Verifying deploy...
remote: 
remote: !       Push rejected to qutesapp.
remote: 
To https://git.heroku.com/qutesapp.git
 ! [remote rejected]   master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/qutesapp.git'

但是,这个应用程序在我的本地机器上运行良好。 我认为这是与作曲家更新有关的问题......有人可以帮我吗?

根据我的经验,这是由于尝试在 PHP 8.1 下运行 Laravel 7(或更早版本)。 尝试更改 PHP 版本

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM