Composer Google API 下载失败

问题描述 投票:0回答:4

我尝试使用 Composer 将 google api 下载到旧代码,但是出现以下错误:

composer require google/apiclient:^2.0
./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
    - Installation request for google/apiclient 2.0 -> satisfiable by google/apiclient[v2.0.0].
    - google/apiclient v2.0.0 requires google/auth 0.8 -> satisfiable by google/auth[v0.8].
    - Conclusion: don't install guzzlehttp/psr7 1.4.2
    - google/auth v0.8 requires guzzlehttp/psr7 1.2.* -> satisfiable by guzzlehttp/psr7[1.2.0, 1.2.1, 1.2.2, 1.2.3].
    - Can only install one of: guzzlehttp/psr7[1.2.0, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.1, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.2, 1.4.2].
    - Can only install one of: guzzlehttp/psr7[1.2.3, 1.4.2].
    - Installation request for guzzlehttp/psr7 (locked at 1.4.2) -> satisfiable by guzzlehttp/psr7[1.4.2].


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

我该怎么办?

google-api composer-php
4个回答
1
投票

尝试删除供应商/谷歌,然后再次运行

composer install
,这对我有用。


0
投票

只能安装其中之一:

guzzlehttp/psr7
[
1.2.3
,
1.4.2
]。

您的依赖项导致软件包的两个不同主要版本混淆,但只能安装一个。

locked at 1.4.2
消息意味着该软件包已根据您的
composer.lock
文件安装,并且您正在尝试安装与您现有条件不兼容的不同版本。

$ composer show -a google/auth | grep psr7
guzzlehttp/psr7 ~1.2

您可以通过检查依赖树来检查哪个现有包依赖于锁定版本:

composer show -t

在某些情况下,删除

composer.lock
可能会有所帮助。

否则,要查看为什么(从哪里)引用该包,请运行:

composer why guzzlehttp/psr7 -t

另请参阅:如何解决“只能安装其中之一:”冲突?


0
投票

我终于找到了适合我的解决方案,只需删除

composer.lock
!!


0
投票

就我而言,这是有效的:

  1. 删除composer中的vendor/google文件夹
  2. 清理作曲家“composerclear-cache”的缓存
  3. 增加安装“composer config process-timeout 3600”的超时
  4. “作曲家安装”

之后您可以将超时减少回 600。

© www.soinside.com 2019 - 2024. All rights reserved.