laravel/framework v10.9.0 requires Composer-runtime-api ^2.2 -> Composer-runtime-api found on Google App Engine standard php81 deployment
P粉368878176
P粉368878176 2023-08-26 19:40:47
0
1
462

尝试将 Laravel 10 应用程序部署到运行 php 8.1 的 Google Cloud 应用引擎标准环境时,会出现以下错误:

运行标准环境时是否可以更新 Google Cloud App Engine Composer-runtime-api?

我已经检查了文档,但没有提及在标准环境中运行的composer版本或composer-runtime-api版本或任何有关如何更改这些版本的描述。

我已经尝试添加 composer-runtime-api ^2.2 作为依赖项,但这导致部署时显示相同的错误。

以下是来自 Google Cloud 的构建日志的相关部分:

===> BUILDING === PHP - Runtime (google.php.runtime@0.0.2) === Using runtime version from GOOGLE_RUNTIME_VERSION: 8.1.17 DEBUG: ***** CACHE MISS: "php" Installing PHP Runtime v8.1.17. 2023/04/29 13:55:22 [DEBUG] GET https://dl.google.com/runtimes/ubuntu1804/php/php-8.1.17.tar.gz Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to .sbom., launch.sbom., or build.sbom.. Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to .sbom., launch.sbom., or build.sbom.. Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to .sbom., launch.sbom., or build.sbom.. === PHP - Composer Install (google.php.composer-install@0.0.1) === DEBUG: ***** CACHE MISS: "composer" 2023/04/29 13:55:27 [DEBUG] GET https://getcomposer.org/installer 2023/04/29 13:55:27 [DEBUG] GET https://composer.github.io/installer.sig -------------------------------------------------------------------------------- Running "bash -c php -d 'error_reporting=24575' -r \"echo hash_file('sha384', '/layers/google.php.composer-install/composer/composer-setup-2629473669.php');\"" xxxx "bash -c php -d 'error_reporting=24575' -r \"echo hash_file('s..." (425.829387ms) installing Composer v2.1.3 -------------------------------------------------------------------------------- Running "bash -c php /layers/google.php.composer-install/composer/composer-setup-2629473669.php --install-dir /layers/google.php.composer-install/composer/bin --filename composer --version 2.1.3" All settings correct for using Composer Downloading... Composer (version 2.1.3) successfully installed to: /layers/google.php.composer-install/composer/bin/composer Use it: php /layers/google.php.composer-install/composer/bin/composer Done "bash -c php /layers/google.php.composer-install/composer/com..." (258.279492ms) Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to .sbom., launch.sbom., or build.sbom.. Warning: BOM table is deprecated in this buildpack api version, though it remains supported for backwards compatibility. Buildpack authors should write BOM information to .sbom., launch.sbom., or build.sbom.. === PHP - Composer (google.php.composer@0.9.1) === -------------------------------------------------------------------------------- Running "php -r echo PHP_VERSION;" 8.1.17Done "php -r echo PHP_VERSION;" (17.67139ms) DEBUG: Current dependency hash: "xxxx" DEBUG: Cache dependency hash: "" DEBUG: ***** CACHE MISS: "prod dependencies" DEBUG: No metadata found from a previous build, skipping cache. Installing application dependencies. -------------------------------------------------------------------------------- Running "composer install --no-dev --no-progress --no-interaction --optimize-autoloader" Deprecated: Return type of Symfony\Component\Console\Helper\HelperSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/symfony/console/Helper/HelperSet.php on line 112 Deprecation Notice: strlen(): Passing null to parameter #1 ($string) of type string is deprecated in phar:///layers/google.php.composer-install/composer/bin/composer/vendor/justinrainbow/json-schema/src/JsonSchema/Constraints/Constraint.php:48 Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286 Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286 Deprecation Notice: Return type of Composer\Repository\ArrayRepository::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/Repository/ArrayRepository.php:286 Installing dependencies from lock file Verifying lock file contents can be installed on current platform. Deprecation Notice: Return type of Composer\DependencyResolver\Pool::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Pool.php:82 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSet.php:119 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSet::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSet.php:101 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:155 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:165 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:160 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:170 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::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/src/Composer/DependencyResolver/Decisions.php:150 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:145 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:36 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:46 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:41 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:89 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::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/src/Composer/DependencyResolver/RuleSetIterator.php:70 Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 - laravel/framework is locked to version v10.9.0 and an update of this package was not requested. - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. Problem 2 - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. - spatie/laravel-permission 5.10.1 requires illuminate/auth ^7.0|^8.0|^9.0|^10.0 -> satisfiable by laravel/framework[v10.9.0]. - spatie/laravel-permission is locked to version 5.10.1 and an update of this package was not requested. Done "composer install --no-dev --no-progress --no-interaction --o..." (523.780904ms) Failure: (ID: 8fe845e7) ...google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:150 Deprecation Notice: Return type of Composer\DependencyResolver\Decisions::count() should either be compatible with Countable::count(): int, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/Decisions.php:145 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::current() should either be compatible with Iterator::current(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:36 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::next() should either be compatible with Iterator::next(): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:46 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::key() should either be compatible with Iterator::key(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:41 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::valid() should either be compatible with Iterator::valid(): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in phar:///layers/google.php.composer-install/composer/bin/composer/src/Composer/DependencyResolver/RuleSetIterator.php:89 Deprecation Notice: Return type of Composer\DependencyResolver\RuleSetIterator::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/src/Composer/DependencyResolver/RuleSetIterator.php:70 Your lock file does not contain a compatible set of packages. Please run composer update. Problem 1 - laravel/framework is locked to version v10.9.0 and an update of this package was not requested. - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. Problem 2 - laravel/framework v10.9.0 requires composer-runtime-api ^2.2 -> found composer-runtime-api[2.1.0] but it does not match the constraint. - spatie/laravel-permission 5.10.1 requires illuminate/auth ^7.0|^8.0|^9.0|^10.0 -> satisfiable by laravel/framework[v10.9.0]. - spatie/laravel-permission is locked to version 5.10.1 and an update of this package was not requested. -------------------------------------------------------------------------------- Running "mv -f /builder/outputs/output-1561546128934258592 /builder/outputs/output" Done "mv -f /builder/outputs/output-1561546128934258592 /builder/o..." (16.23967ms) ERROR: failed to build: exit status 1

在我的 app.yaml 中,我只设置了运行时,如下所示:

运行时:php81

以及其他一些不相关的处理程序和环境变量。

P粉368878176
P粉368878176

reply all (1)
P粉128563140

Google provides an answer on its IssueTracker stating that you can specify:

build_env_variables: GOOGLE_COMPOSER_VERSION: 2.2.1

Now override the Composer version on the GAE service inapp.yaml.

Not tested yet.

edit: Tested but not working, updated the Google Cloud SDK on my local machine to the latest version (435.0.1) as recommended by the Google team, but not working. The solution will be posted once it is found.

Edit 2:

Now using Composer version2.5.8for testing and working. Not sure if the failure with version2.2.1is a bug, but I can useapp.yaml中的以下配置将 Laravel 10 部署到 App Engine 标准环境>.

build_env_variables: GOOGLE_COMPOSER_VERSION: 2.5.8
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!