【问题标题】:Cannot update dependencies with composer无法使用作曲家更新依赖项
【发布时间】:2019-12-02 22:16:02
【问题描述】:

我正在尝试通过 composer 在生产服务器上安装包 tymon/jwt-auth,我在解决依赖关系时遇到错误。

我已在本地 vagrant 环境中成功安装它,但在生产服务器上时会出现以下输出。

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

  Problem 1
    - Conclusion: don't install laravel/socialite 3.0.x-dev
    - Conclusion: remove guzzlehttp/guzzle 6.2.x-dev|install laravel/socialite 3.0.x-dev
    - laravel/socialite v2.0.0 requires guzzlehttp/guzzle ~4.0 -> satisfiable by guzzlehttp/guzzle[4.x-dev].
    - laravel/socialite v2.0.1 requires guzzlehttp/guzzle ~4.0|~5.0 -> satisfiable by guzzlehttp/guzzle[4.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.x-dev].
    - laravel/socialite v2.0.2 requires guzzlehttp/guzzle ~4.0|~5.0 -> satisfiable by guzzlehttp/guzzle[4.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.x-dev].
    - laravel/socialite v2.0.3 requires guzzlehttp/guzzle ~4.0|~5.0 -> satisfiable by guzzlehttp/guzzle[4.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.x-dev].
    - laravel/socialite v2.0.4 requires guzzlehttp/guzzle ~4.0|~5.0 -> satisfiable by guzzlehttp/guzzle[4.x-dev, 5.3.0, 5.3.1, 5.3.2, 5.3.3, 5.3.x-dev].
    - Can only install one of: guzzlehttp/guzzle[5.3.0, 6.2.x-dev].
    - Can only install one of: guzzlehttp/guzzle[5.3.1, 6.2.x-dev].
    - Can only install one of: guzzlehttp/guzzle[5.3.2, 6.2.x-dev].
    - Can only install one of: guzzlehttp/guzzle[5.3.3, 6.2.x-dev].
    - Can only install one of: guzzlehttp/guzzle[5.3.x-dev, 6.2.x-dev].
    - Can only install one of: guzzlehttp/guzzle[4.x-dev, 6.2.x-dev].
    - Installation request for guzzlehttp/guzzle (locked at 6.2.x-dev, required as ~5.3|~6.0) -> satisfiable by guzzlehttp/guzzle[6.2.x-dev].
    - Conclusion: remove laravel/socialite 3.0.x-dev|install laravel/socialite v2.0.0|install laravel/socialite v2.0.1|install laravel/socialite v2.0.2|install laravel/socialite v2.0.3|install laravel/socialite v2.0.4
    - Can only install one of: laravel/socialite[2.0.x-dev, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.10, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.11, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.12, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.13, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.14, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.15, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.16, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.17, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.18, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.19, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.20, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.21, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.22, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.5, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.6, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.7, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.8, 3.0.x-dev].
    - Can only install one of: laravel/socialite[v2.0.9, 3.0.x-dev].
    - Installation request for laravel/socialite (locked at 3.0.x-dev, required as ^2.0@dev) -> satisfiable by laravel/socialite[3.0.x-dev].
    - Installation request for laravel/socialite ^2.0@dev -> satisfiable by laravel/socialite[2.0.x-dev, v2.0.0, v2.0.1, v2.0.10, v2.0.11, v2.0.12, v2.0.13, v2.0.14, v2.0.15, v2.0.16, v2.0.17, v2.0.18, v2.0.19, v2.0.2, v2.0.20, v2.0.21, v2.0.22, v2.0.3, v2.0.4, v2.0.5, v2.0.6, v2.0.7, v2.0.8, v2.0.9].

我已经通过运行 composer update 和 composer require tymon/jwt-auth 在服务器上进行了尝试。

如何着手解决这个问题?

提前致谢。

PS:这是我的 composer.json 文件。

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "minimum-stability": "dev",
    "repositories": [
        {
            "type": "git",
            "url": "https://github.com/cholung/laravel-model-builder.git"
        },
        {
            "type": "git",
            "url": "https://github.com/vorodevops/l5scaffold.git"
        },
        {
          "type": "vcs",
          "url": "https://github.com/alnutile/l5scaffold.git"
        }
    ],
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "ramsey/uuid": "^3.2",
        "intervention/image": "^2.3",
        "guzzlehttp/guzzle": "~5.3|~6.0",
        "laravel/socialite": "^2.0@dev",
        "predis/predis": "^1.1@dev",
        "pda/pheanstalk": "~3.0",
        "xinax/laravel-gettext": "3.x",
        "laravelcollective/html": "5.1.*",
        "doctrine/dbal": "^2.5",
        "moltin/laravel-cart": "^5.0",
        "jenssegers/date": "^3.2",
        "barryvdh/laravel-dompdf": "0.6.*",
        "maatwebsite/excel": "~2.1.0",
        "jenssegers/agent": "^2.3",
        "yajra/laravel-datatables-oracle": "~6.0",
        "wisembly/elephant.io": "^3.1",
        "dimsav/laravel-translatable": "^6.0",
        "sammyk/laravel-facebook-sdk": "^3.0"
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~4.0",
        "phpspec/phpspec": "~2.1",
        "jimbolino/laravel-model-builder" : "dev-master",
        "laralib/l5scaffold": "dev-viewonly",
        "barryvdh/laravel-debugbar": "^2.0"
    },
    "autoload": {
        "classmap": [
            "database"
        ],
        "psr-4": {
            "App\\": "app/",
            "Artvisual\\Tools\\": "packages/artvisual/tools/src",
            "Artvisual\\Tools\\Providers\\": "packages/artvisual/tools/src/Providers",
            "Artvisual\\Payment\\": "packages/artvisual/payment/src"
        }
    },
    "autoload-dev": {
        "classmap": [
            "tests/TestCase.php"
        ]
    },
    "scripts": {
        "post-install-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "pre-update-cmd": [
        ],
        "post-update-cmd": [
            "php artisan clear-compiled",
            "php artisan optimize"
        ],
        "post-root-package-install": [
            "php -r \"copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "php artisan key:generate"
        ]
    },
    "config": {
        "preferred-install": "dist"
    }
}

【问题讨论】:

  • 你没有在本地更新composer.lock文件,然后只运行composer install来准备你的生产环境是不是有什么特殊原因?
  • @xabbuh 自从我接管了整个项目后,我意识到开发它的工作人员只是在推composer.json,而不是composer.lock。事实上,composer.lock 在本地和服务器中看起来非常不同。恐怕如果我从本地环境推送composer.lock 并执行composer install 一些想法将开始不起作用,而这个项目非常大,开始做出如此大的改变。事实上,我在服务器上发出的所有composer update 命令都是用--dry-run 标志发出的,只是为了知道会发生什么。
  • @Kevin 是的,我做到了,但这对我不起作用。无论如何,谢谢。
  • 然后将 composer.lock 从您的 prod 环境带回 dev 并将其推送到代码存储库。不幸的是,您需要重新开始您的开发环境,但这是唯一的保存方法。如果你不使用 composer.lock 项目迟早会在产品上中断

标签: laravel composer-php jwt guzzle laravel-socialite


【解决方案1】:

如果有人仍然需要解决这个问题。在这个guide 中,它说你应该

  1. composer require 旧版本的guzzlehttp/guzzle,例如composer require guzzlehttp/guzzle:^5.3.0
  2. composer require 您最初希望安装的软件包,例如 composer require laravel/socialite
  3. composer remove guzzlehttp/guzzle 依赖再次与 composer remove guzzlehttp/guzzle

在需要 jonasva/google-trends 依赖项时出现此错误,这为我解决了问题。

【讨论】:

    【解决方案2】:

    我也遇到了同样的问题,guzzle 版本是 7.0。 我已经通过将 composer.json 中的版本更改为 6.0 并更新它来解决它。

    【讨论】:

      猜你喜欢
      • 2016-09-23
      • 1970-01-01
      • 1970-01-01
      • 2015-06-14
      • 2016-12-30
      • 2013-05-30
      • 1970-01-01
      • 2019-04-05
      • 2019-03-06
      相关资源
      最近更新 更多