以前一直觉得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并不可怕。
點(diǎn)擊查看更多內(nèi)容
4人點(diǎn)贊
評(píng)論
評(píng)論
共同學(xué)習(xí),寫(xiě)下你的評(píng)論
評(píng)論加載中...
作者其他優(yōu)質(zhì)文章
正在加載中
感謝您的支持,我會(huì)繼續(xù)努力的~
掃碼打賞,你說(shuō)多少就多少
贊賞金額會(huì)直接到老師賬戶(hù)
支付方式
打開(kāi)微信掃一掃,即可進(jìn)行掃碼打賞哦
今天注冊(cè)有機(jī)會(huì)得
100積分直接送
付費(fèi)專(zhuān)欄免費(fèi)學(xué)
大額優(yōu)惠券免費(fèi)領(lǐng)