继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

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

喵喵清吟
关注TA
已关注
手记 1
粉丝 7
获赞 8

以前一直觉得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并不可怕。

打开App,阅读手记
4人推荐
发表评论
随时随地看视频慕课网APP