gpt4 book ai didi

未为 laravel 8 安装图像干预包

转载 作者:行者123 更新时间:2023-12-05 09:04:45 25 4
gpt4 key购买 nike

无法将您的要求解析为一组可安装的软件包。

问题 1

- intervention/image[2.5.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.
- Root composer.json requires intervention/image ^2.5 -> satisfiable by intervention/image[2.5.0, 2.5.1].

使用选项 --with-all-dependencies (-W) 允许升级、降级和删除当前锁定到特定版本的包。

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.3",
"laravel/framework": "^8.40",
"laravel/tinker": "^2.5",
"laravel/ui": "^3.3"
},
"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
}

最佳答案

解决方案

  1. 进入composer.lock文件并搜索guzzlehttp/psr7,你会找到类似这样的东西
    "name": "guzzlehttp/psr7",
"version": "2.0.0",
  1. 将“版本”更改为“1.7.0”

  2. 再次运行命令composer require intervention/image。如果您看到一条消息,指出“正在降级 psr7 (2.0.0 => 1.7.0)”(顺便说一句,我正在使用 powershell),这意味着一切运行正常。

尝试说明

错误消息表明,为了安装 intervention/image,它需要 guzzlehttp/psr7[1.1.0, ..., 1.x-dev]。这意味着它需要版本为 1.x 的 psr7,但是,laravel 8 中的 psr7 是版本 2.0.0,这是不兼容的。了解有关语义版本控制的更多信息 here

你可以在你的 composer.lock 文件中检查这个,通过搜索“guzzlehttp/psr7”然后你会看到类似这样的东西

    "name": "guzzlehttp/psr7",
"version": "2.0.0",

因此,您需要将其降级到1.x 版本。但是1.x版本也有很多,我选择的是1.7.0,因为在guzzlehttp根包中,还有一些其他的子包(我用的术语可能不合适,请原谅)要求psr7至少是1.7 .0,这就是我选择 1.7.0 的原因,到目前为止,干预/图像包对我来说效果很好。

我看到其他一些人评论说删除 composer.lock 文件,它有效。但是我对删除 composer.lock 文件有些担心,因为它包含非常重要的信息......

关于未为 laravel 8 安装图像干预包,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68260822/

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