composer install中提示错误requires composer-runtime-api ^2.0.0 -> no matching package found.的解决办法

composer PHP · best · 于 1年前 发布 · 1365 次阅读

背景

最近在安装一个项目的时候提示如下错误

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

  Problem 1
    - Installation request for jean85/pretty-package-versions 2.0.5 -> satisfiable by jean85/pretty-package-versions[2.0.5].
    - jean85/pretty-package-versions 2.0.5 requires composer-runtime-api ^2.0.0 -> no matching package found.
  Problem 2
    - jean85/pretty-package-versions 2.0.5 requires composer-runtime-api ^2.0.0 -> no matching package found.
    - sentry/sentry-symfony 3.5.4 requires jean85/pretty-package-versions ^1.5 || ^2.0 -> satisfiable by jean85/pretty-package-versions[2.0.5].
    - Installation request for sentry/sentry-symfony 3.5.4 -> satisfiable by sentry/sentry-symfony[3.5.4].

其中发现最核心的问题是requires composer-runtime-api ^2.0.0

这就是说名composer的版本太低了, 需要升级到2.x版本 验证一下:

composer -v

的确是

   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version 1.8.6 2019-06-11 15:03:05

解决办法

升级composer

composer self-update

大功告成啦, 可以用上一步方法验证当前compser版本.

本文由 best 创作,采用 知识共享署名 3.0 中国大陆许可协议 进行许可。 可自由转载、引用,但需署名作者且注明文章出处。

共收到 0 条回复
没有找到数据。
添加回复 (需要登录)
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册