简体   繁体   English

Composer 无法安装 laravel/socialite 2.0

[英]Composer fails to install laravel/socialite 2.0

composer require laravel/socialite ^2.0作曲家需要 laravel/socialite ^2.0

is failing with below error:失败并出现以下错误:

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 version is 5.3.22 Laravel 版本是 5.3.22

PHP version is 7.0.10 PHP版本是7.0.10

The composer.json of socialite2.0 on github shows the dependency as guzzlehttp 5.0/ 6.0. github上socialite2.0的composer.json显示依赖为guzzlehttp 5.0/ 6.0。 Why's my install looking for guzzlehttp 4.0?为什么我的安装在寻找 guzzlehttp 4.0?

EDIT-1:编辑-1:

I tried to force guzzlehttp 4.2.4 by adding it in composer.json require-dev.我试图通过在composer.json require-dev中添加guzzlehttp 4.2.4来强制它。

However, I received following error:但是,我收到以下错误:

  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].

Apparently, aws-sdk-php requires guzzlehttp 5.3/ 6.2.显然,aws-sdk-php 需要 guzzlehttp 5.3/ 6.2。 Laravel 5.3 is not compatible with socialite 3.0. Laravel 5.3 与社交名媛 3.0 不兼容。 Socialite 2.0 is not compatible with guzzlehttp 5.3/ 6.2. Socialite 2.0 与 guzzlehttp 5.3/ 6.2 不兼容。

How to resolve this?如何解决这个问题?

TIA TIA

EDIT-2:编辑-2:

my composer.json has below content:我的 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"
}

} }

Here's how the issue got resolved: It turned out to be simple. 以下是问题的解决方法:事实证明这很简单。 As I'm still learning what composer can do, I couldn't figure it out earlier. 因为我还在学习作曲家能做什么,所以我不能早点弄明白。

Changing from ^ to ~ in the version did the trick. 在版本中从^更改为~就可以了。 As per Mastering Composer - tips & tricks , both tilde ( ~ ) & caret ( ^ ) should allow minor versions in the packages. 根据Mastering Composer的提示和技巧 ,代字号( ~ )和插入符号( ^ )应该允许包中的次要版本。 But, it appears " only be careful of breaking changes " took the precedence over allowing minor versions. 但是,它似乎“ 只注意破坏变化 ”优先于允许次要版本。 (at least, that's the conclusion I arrived at). (至少,这是我得出的结论)。

Following is the result: 以下是结果:

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

I have one idea of this problem. 我对这个问题有一个想法。

In composer.lock , save a hash and version of package that you download with your composer config, in this moment or an another time. composer.lock ,在此刻或其他时间保存您使用composer配置下载的包的哈希和版本。 Then delete this file and vendor folder and execute again: 然后删除此文件和供应商文件夹并再次执行:

composer require laravel/socialite ^2.0

Try: 尝试:

composer require laravel/socialite

Hope it will help. 希望它会有所帮助。

See: Laravel documentation . 请参阅: Laravel文档

试试这个:作曲家需要laravel / socialite:~2.0它对我有用:)

add "laravel/socialite": "2.*", in composer.json then run添加 "laravel/socialite": "2.*", 在 composer.json 然后运行

composer update作曲家更新

and

composer dump-autoload作曲家转储自动加载

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM