【问题标题】:Composer fails to download Google Text-To-Speech libraryComposer 无法下载 Google Text-To-Speech 库
【发布时间】:2019-07-14 01:18:05
【问题描述】:

我正在尝试导入 Google 的 Text-To-Speech 库

composer require google/cloud-text-to-speech

但我得到了这个错误

Using version ^0.4.4 for google/cloud-text-to-speech
./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/cloud-text-to-speech ^0.4.4 -> satisfiable by google/cloud-text-to-speech[v0.4.4].
    - Conclusion: don't install google/gax 0.37.0
    - google/cloud-text-to-speech v0.4.4 requires google/gax ^1.0 -> satisfiable by google/gax[1.0.0, 1.0.1, 1.0.2, 1.0.3].
    - Can only install one of: google/gax[1.0.0, 0.37.0].
    - Can only install one of: google/gax[1.0.1, 0.37.0].
    - Can only install one of: google/gax[1.0.2, 0.37.0].
    - Can only install one of: google/gax[1.0.3, 0.37.0].
    - Installation request for google/gax (locked at 0.37.0) -> satisfiable by google/gax[0.37.0].


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

我该如何解决这个问题?有没有不使用 Composer 的可用库可供下载?

【问题讨论】:

  • 请提供您的 composer.json 文件

标签: php google-cloud-platform composer-php google-text-to-speech


【解决方案1】:

看起来您或您项目中的其他依赖项也需要google/gax,但版本较旧。您可以使用为什么命令找出 google/gax 锁定在 0.37.0 版本的原因:

composer why google/gax

这应该告诉您它是作为根依赖项安装的,这意味着您明确安装了它或其他依赖项需要它。

然后您必须找出该依赖项是否有更新版本,以便您可以升级该依赖项以使用更新版本的google/gax。如果您确定更新是安全的,只需将两个扩展都添加到 require 命令或先更新依赖项,然后再次尝试要求 google/cloud-text-to-speech

Composer 还提供了一种为您自动更新所有依赖项的方法,但这显然会带来更新带来破坏性更改的风险,因此请谨慎使用:

--update-with-dependencies      Allows inherited dependencies to be updated, except those that are root requirements.
--update-with-all-dependencies  Allows all inherited dependencies to be updated, including those that are root requirements.

所以运行:

composer require --update-with-all-dependencies google/cloud-text-to-speech

应更新您的应用程序,使其支持所需的google/gax 版本,以便安装google/cloud-text-to-speech。这可能会导致其他依赖项被更新,您可以检查输出以查看受影响的依赖项。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-05-14
    • 1970-01-01
    • 2019-04-16
    • 2017-04-10
    • 2020-09-24
    • 1970-01-01
    • 2019-03-15
    相关资源
    最近更新 更多