【问题标题】:Laravel 9 upgrade issue during deployment部署期间的 Laravel 9 升级问题
【发布时间】:2022-08-04 14:19:33
【问题描述】:

我有一个部署在 Google Cloud App Engine 中的现有 Laravel 8 应用程序。

我正在尝试升级到 Laravel 9,但是在尝试部署时遇到了一个奇怪的问题-

Updating service [default]...failed.                                                                                                                                                                                                   
ERROR: (gcloud.app.deploy) Error Response: [9] Cloud build 92fff745-cde1-47d0-b66f-5ec5ac4fc026 status: FAILURE
...n Notice: Return type of Symfony\\Component\\Finder\\Iterator\\FileTypeFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/FileTypeFilterIterator.php:42
Deprecation Notice: Return type of Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:55
Deprecation Notice: Return type of Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator::hasChildren() should either be compatible with RecursiveIterator::hasChildren(): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:71
Deprecation Notice: Return type of Symfony\\Component\\Finder\\Iterator\\ExcludeDirectoryFilterIterator::getChildren() should either be compatible with RecursiveIterator::getChildren(): ?RecursiveIterator, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/ExcludeDirectoryFilterIterator.php:76
Deprecation Notice: Return type of Symfony\\Component\\Finder\\Iterator\\FilterIterator::rewind() should either be compatible with Iterator::rewind(): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/FilterIterator.php:30
Deprecation Notice: Return type of Symfony\\Component\\Finder\\Iterator\\PathFilterIterator::accept() should either be compatible with FilterIterator::accept(): bool, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/finder/Iterator/PathFilterIterator.php:27
Class App\\Http\\Controllers\\api\\AllApiController located in ./app/Http/Controllers/Api/AllApiController.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\\Foundation\\ComposerScripts::postAutoloadDump
54 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
> chmod -R 755 bootstrap/cache
> php artisan config:clear

In Compiler.php line 66:
                                      
  Please provide a valid cache path.  
                                      

Script php artisan config:clear handling the post-install-cmd event returned with error code 1

尝试清除路由、缓存或配置时发生错误。这是composer.json 中触发错误的相关部分 -

\"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\"
        ],
        \"post-install-cmd\": [
            \"chmod -R 755 bootstrap\\/cache\",
            \"php artisan config:clear\"
            \"php artisan route:clear\",
            \"php artisan cache:clear\"
        ]
    }

我试过谷歌,但还没有找到任何相关的答案。我不太确定是什么导致了这个问题,并且用尽了我能想到的所有途径。对此的任何帮助将不胜感激。

我正在从 Laravel 8.0 升级到 9.11 和 PHP 7.28.0.2

在我的app.yaml 中,应用引擎的运行时间设置为php81

由于storage 目录结构,一些用户遇到了类似的错误。我在存储下有以下目录结构,但是我认为该错误与此无关。我的目录结构完全没有变化,唯一的变化是 Laravel 和 PHP 的升级。

storage
 - framework
   - cache
      - data
   - sessions
   - views

提前致谢。

  • 您可以尝试运行composer self-update,然后尝试运行composer global update

标签: php google-app-engine laravel-9 php-8.1


【解决方案1】:

尝试将运行时设置为php80https://github.com/symfony/symfony/issues/42231

【讨论】:

  • 我认为,弃用通知与此无关。此外,Google App Engine 目前仅支持 php81 ERROR: (gcloud.app.deploy) INVALID_ARGUMENT: Invalid runtime 'php80' specified。接受的运行时是:[php, php55, python27, java, java7, java8, nodejs8, php72, nodejs16, php74, python310, php73, nodejs10, ruby​​30, nodejs14, nodejs12, java17, php81, java11, go116, go114, go115, go112 , python38, go113, python37, go111, python39, ruby​​27, ruby​​26, ruby​​25]
【解决方案2】:

安装新的 PHP 版本后,您是否运行了 composer global update 以便升级全局 composer 依赖项?

您可以尝试运行 composer self-update,然后尝试运行全局更新。

你也可以参考这个GitHub link

【讨论】:

    猜你喜欢
    • 2023-03-26
    • 1970-01-01
    • 2020-05-16
    • 2021-05-22
    • 1970-01-01
    • 1970-01-01
    • 2020-08-17
    • 2020-12-05
    • 2018-10-18
    相关资源
    最近更新 更多