Php Composer未能安装laravel/socialite 2.0

Php Composer未能安装laravel/socialite 2.0,php,laravel,composer-php,laravel-socialite,guzzlehttp,Php,Laravel,Composer Php,Laravel Socialite,Guzzlehttp,作曲家需要拉威尔/社交名流^2.0 正在失败,错误如下: Your requirements could not be resolved to an installable set of packages. Problem 1 - Installation request for laravel/socialite 2.0 -> satisfiable by laravel/socialite[v2.0.0]. - Conclusion: remove guzzleh

作曲家需要拉威尔/社交名流^2.0

正在失败,错误如下:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for laravel/socialite 2.0 -> satisfiable by laravel/socialite[v2.0.0].
    - Conclusion: remove guzzlehttp/guzzle 6.2.2
    - Conclusion: don't install guzzlehttp/guzzle 6.2.2
    - laravel/socialite v2.0.0 requires guzzlehttp/guzzle ~4.0 -> satisfiable by guzzlehttp/guzzle[4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 4.1.7, 4.1.8, 4.2.0, 4.2.1, 4.2.2, 4.2.3, 4.2.4].
    - Can only install one of: guzzlehttp/guzzle[4.0.0, 6.2.2].
    ...
    - Can only install one of: guzzlehttp/guzzle[4.2.4, 6.2.2].
    - Installation request for guzzlehttp/guzzle (locked at 6.2.2) -> satisfiable by guzzlehttp/guzzle[6.2.2].


Installation failed, reverting ./composer.json to its original content.
Laravel版本是5.3.22

PHP版本是7.0.10

github上的显示依赖项为guzzlehttp 5.0/6.0。为什么我的安装要寻找guzzlehttp 4.0

编辑-1:

我试图通过在composer.json require-dev中添加它来强制guzzlehttp 4.2.4

但是,我收到了以下错误:

  Problem 1
    - The requested package guzzlehttp/guzzle (locked at 6.2.2, required as 4.2.4) is satisfiable by guzzlehttp/guzzle[6.2.2] but these conflict with your requirements or minimum-stability.
  Problem 2
    - aws/aws-sdk-php 3.19.23 requires guzzlehttp/guzzle ^5.3.1|^6.2.1 -> satisfiable by guzzlehttp/guzzle[5.3.1, 5.3.2, 5.3.x-dev, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.2.x-dev] but these conflict with your requirements or minimum-stability.
    - aws/aws-sdk-php 3.19.23 requires guzzlehttp/guzzle ^5.3.1|^6.2.1 -> satisfiable by guzzlehttp/guzzle[5.3.1, 5.3.2, 5.3.x-dev, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.2.x-dev] but these conflict with your requirements or minimum-stability.
    - aws/aws-sdk-php 3.19.23 requires guzzlehttp/guzzle ^5.3.1|^6.2.1 -> satisfiable by guzzlehttp/guzzle[5.3.1, 5.3.2, 5.3.x-dev, 6.2.1, 6.2.2, 6.2.3, 6.3.0, 6.2.x-dev] but these conflict with your requirements or minimum-stability.
    - Installation request for aws/aws-sdk-php (locked at 3.19.23) -> satisfiable by aws/aws-sdk-php[3.19.23].
显然,aws sdk php需要HTTP 5.3/6.2。Laravel 5.3与socialite 3.0不兼容。社交名媛2.0与guzzlehttp 5.3/6.2不兼容

如何解决这个问题

短暂性脑缺血发作

编辑-2:

my composer.json包含以下内容:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.3.*",
    "doctrine/dbal": "^2.5",
    "aws/aws-sdk-php-laravel": "~3.0"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.0",
    "symfony/css-selector": "3.1.*",
    "symfony/dom-crawler": "3.1.*"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "classmap": [
        "tests/TestCase.php"
    ]
},
"scripts": {
    "post-root-package-install": [
        "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist"
}
}试试:

composer require laravel/socialite
希望这会有帮助


请看:。

我对这个问题有一个想法

composer.lock
中,保存当前或其他时间随composer配置下载的软件包的哈希和版本。然后删除此文件和供应商文件夹并再次执行:

composer require laravel/socialite ^2.0

这个问题是如何解决的:结果很简单。因为我还在学习作曲家能做什么,所以我不能更早地理解它

在版本中将
^
更改为
~
,成功了。根据,tilde(
~
)和caret(
^
)都应该允许在包中使用次要版本。但是,与允许小版本相比,“只需小心破坏更改”似乎更为重要。(至少,这是我得出的结论)

结果如下:

composer require laravel/socialite:~2.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing league/oauth1-client (1.7.0): Downloading (100%)
  - Installing laravel/socialite (v2.0.21): Downloading (100%)
Writing lock file
Generating autoload files
> Illuminate\Foundation\ComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
Compiling common classes

试试这个:作曲家需要拉威尔/社交名流:~2.0
这对我来说很有用:)

这个comand下载3.0版的socialite,但是@krsna需要2.0v,socialite 3.0版至少需要5.4v的Laravel。这不是一个选项,solutionVersion不重要,它将正常工作。我想如果他下载了最新版本,那么代码将无法工作,你能发布你的composer.json文件吗?一种可能是在aws/aws sdk php的旧版本上安装,例如这个包的2.8版本。另一种解决方案是在5.4将你的laravel版本更新为5.3,这是系统支持的必备条件@ThomasEdwards,我发布了composer.json。将
guzzlehttp4.2.4
添加到
require dev
中揭示了aws-sdk-php依赖关系。升级Laravel版本或降级aws sdk php需要花费大量精力来验证应用程序。不幸的是,这不是一个选项。顺便说一句,我的主要要求是允许用户从我们的网站(而不是链接)将照片发布到FB/Twitter/G+。是否有其他方法可以实现这一目标?