gpt4 book ai didi

php - Composer 版本匹配错误 laravel + spatie medialibrary

转载 作者:行者123 更新时间:2023-12-04 14:54:55 27 4
gpt4 key购买 nike

我尝试使用 laravel new <appname> 通过 laravel 安装程序创建一个新的 Laravel 应用程序.
这没有问题。一旦我尝试安装 spatie/medialibrary我收到以下无法解释的错误:

$ composer require "spatie/laravel-medialibrary:^9.0.0"
./composer.json has been updated
Running composer update spatie/laravel-medialibrary
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- spatie/laravel-medialibrary[9.0.0, ..., 9.6.4] require spatie/image ^1.4.0 -> satisfiable by spatie/image[1.4.0, ..., v1.x-dev].
- spatie/image[1.10.0, ..., v1.x-dev] require league/glide ^1.6 -> satisfiable by league/glide[1.6.0, 1.6.1, 1.7.0, 1.x-dev].
- spatie/image[1.7.5, ..., 1.9.0] require league/glide ^1.4 -> satisfiable by league/glide[1.4.0, ..., 1.x-dev].
- league/glide[1.4.0, ..., 1.x-dev] require intervention/image ^2.4 -> satisfiable by intervention/image[2.4.0, ..., 2.5.1].
- intervention/image 2.4.x-dev is an alias of intervention/image dev-master and thus requires it to be installed too.
- spatie/image 1.10.3 requires league/glide ^2.0 -> satisfiable by league/glide[2.0.0, 2.0.x-dev].
- intervention/image[dev-master, 2.4.0, ..., 2.5.1] require guzzlehttp/psr7 ~1.1 -> found guzzlehttp/psr7[1.1.0, ..., 1.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- league/glide 2.0.x-dev requires guzzlehttp/psr7 ^1.1 -> found guzzlehttp/psr7[1.1.0, ..., 1.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- league/glide 2.0.0 requires league/flysystem ^2.0 -> found league/flysystem[2.0.0-alpha.1, ..., 2.x-dev] but the package is fixed to 1.1.4 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- spatie/image 1.4.0 requires symfony/process ^3.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev] but the package is fixed to v5.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- spatie/image[1.4.1, ..., 1.7.4] require symfony/process ^3.0|^4.0 -> found symfony/process[v3.0.0-BETA1, ..., 3.4.x-dev, v4.0.0-BETA1, ..., 4.4.x-dev] but the package is fixed to v5.3.2 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires spatie/laravel-medialibrary ^9.0.0 -> satisfiable by spatie/laravel-medialibrary[9.0.0, ..., 9.6.4].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Installation failed, reverting ./composer.json and ./composer.lock to their original content.
即使我尝试让 Composer 自动升级/降级不匹配的包,我仍然会遇到类似的错误:
$ composer require "spatie/laravel-medialibrary:^9.0.0" -W                                                                                                                             
./composer.json has been updated
Running composer update spatie/laravel-medialibrary --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- Root composer.json requires laravel/framework ^8.0, found laravel/framework[v8.0.0, ..., 8.x-dev] but these were not loaded, likely because it conflicts with another require.


Installation failed, reverting ./composer.json and ./composer.lock to their original content.
这也是我的 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",
"laravel/framework": "^8.0",
"laravel/tinker": "^2.5"
},
"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"
},
"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-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
}
作曲版本: Composer version 2.1.3 2021-06-09 16:31:20PHP版本:
$ php -v
PHP 7.4.9 (cli)
我不明白这里的问题是什么,laravel 安装的要求是通过新创建的应用程序来满足的,并且 medialibrary 包需要 7+ 版本的 laravel 框架。
我是否错过了告诉我出了什么问题的东西?
谢谢

最佳答案

您可以通过运行忽略平台要求

 composer install --ignore-platform-reqs
或升级,降级
composer install --with-all-dependencies
并删除 composer.lock 文件(安装前)
sudo rm  composer.lock

关于php - Composer 版本匹配错误 laravel + spatie medialibrary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68239451/

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