最近,除了app.yaml中的环境变量之外,没有任何代码更改,在云端构建过程中,应用程序引擎部署失败,超过内存限制,我不知道在哪里可以更改它,或者为什么会成为一个问题……我试图设置"gcp-build“来覆盖composer安装命令,但是在云构建过程中得到了这个错误:
Step #3 - "detector": ======== Output: google.php.composer-gcp-build@0.9.0 ========
Step #3 - "detector": unmarshalling composer.json: json: cannot unmarshal array into Go struct field composerScriptsJSON.scripts.gcp-build of type string [id:070ec49f]
Step #3 - "detector": ======== Results ========这是我的composer.json:
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.2.5",
"doctrine/dbal": "^2.10",
"fideloper/proxy": "^4.2",
"fruitcake/laravel-cors": "^2.0",
"google/cloud": "^0.142.0",
"google/cloud-core": "^1.39",
"google/cloud-error-reporting": "^0.18.0",
"google/cloud-firestore": "^1.14",
"google/cloud-logging": "^1.21",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.5",
"kreait/firebase-php": "^5.0",
"kreait/firebase-tokens": "^1.10",
"kreait/laravel-firebase": "^2.2",
"kyslik/column-sortable": "^6.3",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^3.0",
"owen-it/laravel-auditing": "^10.0",
"predis/predis": "^1.1",
"propaganistas/laravel-phone": "^4.2",
"superbalist/laravel-google-cloud-storage": "^2.2",
"tymon/jwt-auth": "^1.0"
},
"require-dev": {
"fzaninotto/faker": "^1.9.1",
"mockery/mockery": "^1.3.1",
"phpunit/phpunit": "^9.0",
"nunomaduro/collision": "^5.0"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
},
"classmap": [
"database/seeders",
"database/factories"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump"
],
"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": [
"Illuminate\\Foundation\\ComposerScripts::postInstall",
"composer dump-autoload",
"php artisan optimize",
"chmod -R 755 bootstrap\/cache",
"php artisan migrate --no-interaction --force"
],
"gcp-build": [
"COMPOSER_MEMORY_LIMIT=-1 composer install --no-dev"
]
}}
此外,在云构建期间收到此警告时,是否有机会将编写器更新为v2:
Step #6 - "builder": Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2下面是构建失败的实际问题:
Step #6 - "builder": Updating dependencies
Step #6 - "builder":
Step #6 - "builder": Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Step #6 - "builder":
Step #6 - "builder": Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.Done "composer install --no-dev --no-progress --no-suggest --no-in..." (56.105751566s)
Step #6 - "builder": Failure: (ID: 5888fcc4) Loading composer repositories with package information
Step #6 - "builder": Warning from https://repo.packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
Step #6 - "builder": Updating dependencies
Step #6 - "builder":
Step #6 - "builder": Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) in phar:///usr/local/bin/composer/src/Composer/DependencyResolver/RuleWatchGraph.php on line 52
Step #6 - "builder":
Step #6 - "builder": Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more info on how to handle out of memory errors.在app.yaml中使用的运行时是php74,也试图将其更改为php72,同样的问题。
发布于 2020-10-30 02:15:55
由于已部署的应用程序已经有一个从App部署中生成的composer.lock文件,并且默认情况下,App缓存获取依赖项以减少构建时间。它将阻止您自动获取依赖项的最新版本,并且您将遇到以下错误:
您正在使用的是过时版本的Composer
要解决这个问题,请在本地运行命令composer install,将您的依赖项绑定到当前版本,并在composer.lock和composer update (如果composer.lock是现有)的情况下使用。然后使用命令“gcloud beta应用程序部署--无缓存”进行部署,以安装依赖项的非缓存版本。
https://stackoverflow.com/questions/64581867
复制相似问题