我尝试在全新的 Laravel 安装中安装 Laravel Breeze,但出现以下错误
Problem 1
- Root composer.json requires laravel/breeze ^2.1 -> satisfiable by laravel/breeze[v2.1.0, ..., v2.1.5].
- laravel/breeze[v2.1.0, ..., v2.1.5] require illuminate/console ^11.0 -> found illuminate/console[v11.0.0, ..., v11.22.0] but these were not loaded, likely because it conflicts with another require.
我尝试运行
composer require laravel/breeze:*
,
但这会返回no matches found: laravel/breeze:*
并且还尝试运行
composer require laravel/breeze:^2.1
返回上面提到的第一个错误。
还尝试通过
composer update
更新作曲家包。这是我的composer.json
{
"name": "laravel/laravel",
"type": "project",
"description": "The skeleton application for the Laravel framework.",
"keywords": ["laravel", "framework"],
"license": "MIT",
"require": {
"php": "^8.1",
"guzzlehttp/guzzle": "^7.2",
"laravel/framework": "^10.10",
"laravel/sanctum": "^3.3",
"laravel/tinker": "^2.8"
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
"nunomaduro/collision": "^7.0",
"phpunit/phpunit": "^10.1",
"spatie/laravel-ignition": "^2.0"
},
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "database/factories/",
"Database\\Seeders\\": "database/seeders/"
}
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover --ansi"
],
"post-update-cmd": [
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"
],
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate --ansi"
]
},
"extra": {
"laravel": {
"dont-discover": []
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true,
"allow-plugins": {
"pestphp/pest-plugin": true,
"php-http/discovery": true
}
},
"minimum-stability": "stable",
"prefer-stable": true
}
Breeze v2 仅支持 Laravel 11。
你不需要在 Laravel 10 中指定任何版本。Composer 应该为你安装合适的版本。
composer require laravel/breeze --dev
目前正确的方法是在使用 Laravel Installer 创建新项目时选择 Breeze。
laravel new example-app --breeze --stack=blade