gpt4 book ai didi

php - 语法错误,Laravel 更新后意外 ')'

转载 作者:行者123 更新时间:2023-12-04 12:23:04 24 4
gpt4 key购买 nike

我已将我的 Laravel 项目更新为 "laravel/framework": "^8.12"来自 laravel 5.7,但在我运行时更新后 composer dump-autoload它返回这个错误

Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In TestDatabases.php line 148:

syntax error, unexpected ')'
这是我的 composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.3|^8.0",
"fideloper/proxy": "^4.4",
"fruitcake/laravel-cors": "^2.0",
"guzzlehttp/guzzle": "^7.0.1",
"intervention/image": "^2.5",
"laravel/framework": "^8.12",
"laravel/sanctum": "^2.8",
"laravel/tinker": "^2.5",
"laravel/ui": "^2.0",
"barryvdh/laravel-dompdf": "^0.8.3",
"nao-pon/flysystem-google-drive": "~1.1",
"spatie/laravel-backup": "^6.14"
},
"require-dev": {
"facade/ignition": "^2.5",
"fakerphp/faker": "^1.9.1",
"laravel/sail": "^1.0.1",
"mockery/mockery": "^1.4.2",
"nunomaduro/collision": "^5.0",
"phpunit/phpunit": "^9.3.3"
},
"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/"
},
"files": [
"app/Helpers/helpers.php",
"app/Helpers/agent_helper.php",
"app/Helpers/user-helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"minimum-stability": "dev",
"prefer-stable": true,
"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"
]
}
}


如何解决这个错误?

最佳答案

您需要将 PHP 安装升级到至少 7.3 版才能解决此问题。
PHP 7.2 是 EOL (生命周期结束)自 2020 年 11 月 30 日起!
正如评论中已经指出的那样:

Laravel 8 requires php 7.3 or higher


Larvel 8 在 composer.json 中有以下 PHP 版本限制:
"require": {
"php": "^7.3|^8.0"
}
不是 运行 composer--ignore-platform-reqs除非您有(非常罕见的)正当理由这样做。

关于php - 语法错误,Laravel 更新后意外 ')',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66061548/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com