gpt4 book ai didi

php - 您的要求无法解析为一组可安装的软件包。 - 拉维尔 5.7

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:43:16 24 4
gpt4 key购买 nike

我尝试安装一个包

composer require vinkla/instagram php-http/message php-http/guzzle6-adapter 

我不断得到

Do not run Composer as root/super user! See https://getcomposer.org/root for details                          
Using version ^9.1 for vinkla/instagram
Using version ^1.7 for php-http/message
Using version ^2.0 for php-http/guzzle6-adapter
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
- nexmo/client 1.6.1 requires php-http/guzzle6-adapter ^1.0 -> satisfiable by php-http/guzzle6-adapter[v1.0.0, v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability.
- nexmo/client 1.6.1 requires php-http/guzzle6-adapter ^1.0 -> satisfiable by php-http/guzzle6-adapter[v1.0.0, v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability.
- nexmo/client 1.6.1 requires php-http/guzzle6-adapter ^1.0 -> satisfiable by php-http/guzzle6-adapter[v1.0.0, v1.1.0, v1.1.1] but these conflict with your requirements or minimum-stability.
- Installation request for nexmo/client (locked at 1.6.1) -> satisfiable by nexmo/client[1.6.1].


Installation failed, reverting ./composer.json to its original content.

我在

php --版本

PHP 7.2.14-1+ubuntu14.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019 10:33:56) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.2.14-1+ubuntu14.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies

Composer .json

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"laravel/framework": "5.7.*",
"intervention/image": "^2.3",
"laravelcollective/remote": "5.7.*",
"doctrine/dbal": "^2.3",
"league/flysystem-sftp": "^1.0",
"laravelcollective/html": "^5.4.0",
"phpseclib/phpseclib": "~2.0",
"htmlmin/htmlmin": "^5.0",
"league/flysystem-aws-s3-v3": "~1.0",
"vinkla/instagram": "^8.0",
"php-http/message": "^1.6",
"php-http/guzzle6-adapter": "^1.1"
},
"require-dev": {
"phpunit/phpunit": "~7.0",
"phpspec/phpspec": "~5.0",
"symfony/dom-crawler": "~3.1",
"symfony/css-selector": "~3.1",
"filp/whoops" : "~2.0"
},
"autoload": {
"classmap": [ "database" ],

"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
]
},
"scripts": {
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-update-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"post-create-project-cmd": [
"php -r \"copy('.env.example', '.env');\"",
"php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist"
}
}

我应该检查什么来解决这个问题?

最佳答案

有两种常见的方法可以通过 Composer 将新包引入您的项目:更新 composer.json,或使用命令 composer require。看起来你在这里同时做这两件事,而 Composer 变得很困惑。

当你使用composer require时,Composer 通常会使用最新版本。您可以在命令后的屏幕截图中看到这一行:

Using version ^2.0 for php-http/guzzle6-adapter

^2.0 与 Instagram 包冲突,后者需要 ^1.1。您可以通过以下两种方式之一解决此问题:

1) 手动更新 composer.json

你的 composer.json 指定版本 ^1.1 看起来不错,但你不想在中使用 composer require 命令为了安装它。相反,请使用 composer update

您可以在不带任何参数的情况下运行 composer update,它将安装任何新包并更新任何具有可用新版本的现有包。这可能不是您想要的,因此您可以指定要更新的包。在这种情况下,它是您正在安装的:

composer update vinkla/instagram php-http/message php-http/guzzle6-adapter

2)在require命令中明确版本号

您可以使用以下语法在 composer require 中指定版本要求:vendor/package:[version] 因此,您的命令变为:

composer require vinkla/instagram php-http/message php-http/guzzle6-adapter:^1.1

关于php - 您的要求无法解析为一组可安装的软件包。 - 拉维尔 5.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54518891/

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