为了账号安全,请及时绑定邮箱和手机立即绑定

composer安装yiisoft/yii2-apidoc 2.1.0过程及错误解决记录

标签:
PHP

以前一直觉得composer很可怕,动不动就报错,的确表面上看很可怕。
但其实,只要仔细分析它给出的错误提示,按图索骥,是可以解决问题的。
那今天我就记录下我composer安装yiisoft/yii2-apidoc 2.1.0时解决错误的过程。

首先,我安装yii2-apidoc的时候,很慢,于是百度了一下,嗯,这个需要切换成中国镜像就快了,参见Composer中文网,配置镜像的命令是,composer config -g repo.packagist composer https://packagist.phpcomposer.com

然后我就开始安装了,就会提示需要github的token,可以用composer.phar config github-oauth.github.com <token>去配置,token去github获取。

好了,基本准备好了,那就继续安装吧。

composer.phar require yiisoft/yii2-apidoc 2.1.0 -vvv

时报错

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

  Problem 1
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.4, 3.1.1].
    - Can only install one of: phpdocumentor/reflection-docblock[3.1.1, 2.0.4].
    - Can only install one of: phpdocumentor/reflection-docblock[2.0.4, 3.1.1].
    - yiisoft/yii2-apidoc 2.1.0 requires phpdocumentor/reflection-docblock ^2.0.
4 -> satisfiable by phpdocumentor/reflection-docblock[2.0.4].
    - Installation request for yiisoft/yii2-apidoc 2.1.0 -> satisfiable by yiiso
ft/yii2-apidoc[2.1.0].
    - Installation request for phpdocumentor/reflection-docblock (locked at 3.1.
1) -> satisfiable by phpdocumentor/reflection-docblock[3.1.1].

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

解决
先安装

composer.phar require phpdocumentor/reflection-docblock 2.0.4 -vvv

composer.phar require yiisoft/yii2-apidoc 2.1.0 -vvv

然后又报错


  Problem 1
    - Installation request for yiisoft/yii2-apidoc 2.1.0 -> satisfiable by yiiso
ft/yii2-apidoc[2.1.0].
    - Conclusion: remove cebe/markdown 1.1.1
    - Conclusion: don't install cebe/markdown 1.1.1
    - yiisoft/yii2-apidoc 2.1.0 requires cebe/markdown-latex ~1.0 -> satisfiable
 by cebe/markdown-latex[1.0.0, 1.1.0, 1.1.1, 1.1.2, 1.1.3].
    - cebe/markdown-latex 1.0.0 requires cebe/markdown ~1.0.0 -> satisfiable by
cebe/markdown[1.0.0, 1.0.1, 1.0.2].
    - cebe/markdown-latex 1.1.0 requires cebe/markdown ~1.0.0 -> satisfiable by
cebe/markdown[1.0.0, 1.0.1, 1.0.2].
    - cebe/markdown-latex 1.1.1 requires cebe/markdown ~1.0.0 -> satisfiable by
cebe/markdown[1.0.0, 1.0.1, 1.0.2].
    - cebe/markdown-latex 1.1.2 requires cebe/markdown ~1.0.0 -> satisfiable by
cebe/markdown[1.0.0, 1.0.1, 1.0.2].
    - cebe/markdown-latex 1.1.3 requires cebe/markdown ~1.0.0 -> satisfiable by
cebe/markdown[1.0.0, 1.0.1, 1.0.2].
    - Can only install one of: cebe/markdown[1.0.0, 1.1.1].
    - Can only install one of: cebe/markdown[1.0.1, 1.1.1].
    - Can only install one of: cebe/markdown[1.0.2, 1.1.1].
    - Installation request for cebe/markdown (locked at 1.1.1) -> satisfiable by
 cebe/markdown[1.1.1].

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

解决
先安装

composer.phar require cebe/markdown 1.0.0 -vvv

composer.phar require yiisoft/yii2-apidoc 2.1.0 -vvv

这样就安装成功了。

   REASON: Required by the root package: Install command rule (install yiisoft/
yii2-apidoc 2.1.0)

Reading d:\www\testcomposer/vendor/composer/installed.json
Writing lock file
Generating autoload files

所以composer并不可怕。

点击查看更多内容
4人点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消