我正在嘗試在 Laravel 8 中實現自動備份。我決定使用 Laravel-backup 套件“spatie/laravel-backup”。
當我嘗試使用「composer require spatie/laravel-backup」安裝軟體包時出現問題。
我遇到這個問題:
問題1 - spatie/laravel-backup[8.1.0, ..., v8.x-dev] 需要照亮/控制台^9.0 -> 發現照亮/控制台[v9.0.0-beta. 1, ... , 9.x-dev] 但這些沒有加載,可能是因為它與另一個需求衝突。 - 根composer.json需要spatie/laravel-backup ^8.1 ->可由spatie/laravel-backup[8.1.0, 8.1.1, 8.1.2, v8.x-dev]滿足。
我嘗試從類似的問題執行這些命令,答案沒有任何改變:
-composer 需要 spatie/laravel-backup "^8.1" --ignore-platform-reqs
-作曲家需要 spatie/laravel-medialibrary
我還嘗試刪除供應商和composer.lock,然後執行composer install,問題仍然存在。
我猜我的composer.json 檔案有問題:
{ "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "php": "^7.3|^8.0", "ext-gd": "*", "ext-json": "*", "aws/aws-sdk-php": "~3.0", "darkaonline/l5-swagger": "^8.1", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.0.1", "laravel/framework": "^8.75", "laravel/sanctum": "^2.11", "laravel/tinker": "^2.5", "league/flysystem-aws-s3-v3": "^1.0", "maatwebsite/excel": "^3.1", "tymon/jwt-auth": "^1.0", "ext-pdo": "*" }, "require-dev": { "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.4", "nunomaduro/collision": "^5.10", "phpunit/phpunit": "^9.5.10" }, "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 }, "minimum-stability": "dev", "prefer-stable": true }
感謝所有花時間查看我的問題的人。 :))
我在安裝 Spatie 備份時使用 Laravel 9.52 和 php 8.2。遇到同樣的錯誤並透過忽略平台要求解決了它。 Git 錯誤描述中已建議。
根據評論,安裝正確版本的 Laravel Backup。解決了這個問題。