简体   繁体   English

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

[英]Your requirements could not be resolved to an installable set of packages. - Laravel 5.7

I tried to install a package我试图安装一个包

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

I kept getting我不断得到

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.                                       

I am on我在

php --version php --version

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作曲家.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"
    }
}

Any things I should check to fix this issue ?我应该检查什么来解决这个问题?

There are two common ways of requiring new packages into your project via Composer: updating composer.json , or using the command composer require .通过 Composer 将新包添加到您的项目中的常见方法有两种:更新composer.json ,或使用命令composer require It looks like you're doing both here, and Composer is getting confused.看起来您在这里同时进行了两项操作,而 Composer 感到困惑。

When you use composer require , Composer will usually use the latest version.当您使用composer require ,Composer 通常会使用最新版本。 You can see this line in your screenshot after the command:您可以在命令后的屏幕截图中看到这一行:

Using version ^2.0 for php-http/guzzle6-adapter为 php-http/guzzle6-adapter 使用^2.0版本

^2.0 is conflicting with the Instagram package, which requires ^1.1 . ^2.0与 Instagram 包冲突,后者需要^1.1 You can solve this in one of two ways:您可以通过以下两种方式之一解决此问题:

1) Update composer.json manually 1) 手动更新 composer.json

Your composer.json with the version ^1.1 specified looks good, but you don't want to use the composer require command in order to install it.指定版本^1.1 composer.json看起来不错,但您不想使用composer require命令来安装它。 Instead, use composer update .相反,请使用composer update

You can run composer update without any arguments, and it will both install any new packages and update any existing packages that have a new version available.您可以不带任何参数运行composer update ,它将安装任何新软件包并更新任何具有新版本可用的现有软件包。 This may not be what you want, so instead you can specify the packages you want to update.这可能不是您想要的,因此您可以指定要更新的包。 In this case, it's the ones you're installing:在这种情况下,它是您正在安装的那些:

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

2) Be explicit with the version number in require command 2)在require命令中明确版本号

You can specify version requirements in composer require using the following syntax: vendor/package:[version] So, your command becomes:您可以使用以下语法在composer require指定版本要求: vendor/package:[version]因此,您的命令变为:

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

I also encountered this on some packages, based on your error, you can just specify the package version.我在一些包上也遇到过这个问题,根据你的错误,你可以指定包版本。 This worked for me:这对我有用:

composer require php-http/guzzle6-adapter:^1.1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误:无法将您的要求解析为一组可安装的软件包。 Laravel - Error: Your requirements could not be resolved to an installable set of packages. Laravel Laravel安装“您的要求无法解决为一组可安装的软件包。” - Laravel Installation “ Your requirements could not be resolved to an installable set of packages.” 您的要求无法解决为一组可安装的软件包。 (Laravel) - Your requirements could not be resolved to an installable set of packages. (Laravel) 您的要求无法解析为 laravel 5.7 中的一组可安装软件包 - Your requirements could not be resolved to an installable set of packages in laravel 5.7 您的要求无法解决为一组可安装的软件包。 用于运行应用程序 - Your requirements could not be resolved to an installable set of packages. for running an application 您的要求无法解决为一组可安装的软件包。 - Symfony 项目 - Your requirements could not be resolved to an installable set of packages. - Symfony Project 您的要求无法解析为可安装的软件包集。 使用作曲家 - Your requirements could not be resolved to an installable set of packages. using composer 您的要求无法解决为一组可安装的软件包。 - Laravel 流明邮件 - Your requirements could not be resolved to an installable set of packages. - Laravel Lumen Mail 我怎么能解决“您的要求无法解析为一组可安装的软件包”。 在 laravel8 - how can i slove "Your requirements could not be resolved to an installable set of packages." in laravel8 当我运行作曲家更新时,我得到“您的要求无法解决为一组可安装的软件包。” - I get “Your requirements could not be resolved to an installable set of packages.” when I run composer update
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM