gpt4 book ai didi

php - 更新到 Laravel 7 php artisan 后无法正常工作

转载 作者:行者123 更新时间:2023-12-05 08:17:03 26 4
gpt4 key购买 nike

根据文档将 Laravel 升级到 v7 后,我运行了 composer update。然后我得到这个:

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

这是我的 composer.json 文件:

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": [
"framework",
"laravel"
],
"license": "MIT",
"require": {
"php": "^7.1.3",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.5",
"kitetail/zttp": "^0.6.0",
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"laravel/telescope": "^2.1",
"laravelcollective/html": "^6.0",
"livewire/livewire": "^0.7.4",
"spatie/laravel-html": "^2.24",
"spatie/laravel-permission": "^3.0.0"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.2",
"filp/whoops": "^2.0",
"fzaninotto/faker": "^1.4",
"laravel/ui": "^2.0",
"mockery/mockery": "^1.0",
"nunomaduro/collision": "^4.1",
"phpunit/phpunit": "^7.5"
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"autoload": {
"psr-4": {
"App\\": "app/"
},
"classmap": [
"database/seeds",
"database/factories"
]
},
"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 artisan 在这个项目中没有做任何事情。在其他项目中,它工作正常。知道如何解决这个问题吗?

编辑:一些答案提供了建议。我使用 Laragon 得到以下信息:

PS C:\laragon\www\attila> composer update
Updating dependencies (including require-dev)
Package operations: 0 installs, 4 updates, 0 removals
- Updating laravel/framework (v7.0.1 => v7.0.2): Downloading (100%)
- Updating spatie/laravel-permission (3.10.1 => 3.11.0): Downloading (100%)
- Updating laravel/ui (v2.0.0 => v2.0.1): Downloading (100%)
- Updating nunomaduro/collision (v4.1.1 => v4.1.2): Downloading (100%)
Package moontoast/math is abandoned, you should avoid using it. Use brick/math instead.
Writing lock file
Generating optimized autoload files
> @php artisan package:discover --ansi
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
PS C:\laragon\www\attila> php artisan package:discover --ansi
PS C:\laragon\www\attila>

最佳答案

删除bootstrapstorage/framework文件夹中的所有缓存后,仍然没有结果。

运行 php artisan --help 会返回一些错误,这给了我提示问题出在哪里。

检查 Upgrade Guide 后我解决了这个问题,对我来说是:

  • App\Exceptions\Handler 方法的变化
  • 安装需要的laravel/ui

关于php - 更新到 Laravel 7 php artisan 后无法正常工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60521358/

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