无法使用composer安装wp-cli

时间:2016-12-16 21:16:12

标签: php wordpress composer-php

尝试全局安装wp-cli - 但它不起作用:

 $ composer global require wp-cli/wp-cli
Changed current directory to /home/self/.composer
Using version ^1.0 for wp-cli/wp-cli
./composer.json has been created
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 wp-cli/wp-cli ^1.0 -> satisfiable by wp-cli/wp-cli[v1.0.0].
    - Conclusion: remove symfony/console v3.0.2
    - Conclusion: don't install symfony/console v3.0.2
    - wp-cli/wp-cli v1.0.0 requires symfony/console ~2.7 -> satisfiable by symfony/console[v2.7.0, v2.7.1, v2.7.10, v2.7.11, v2.7.12, v2.7.13, v2.7.14, v2.7.15, v2.7.16, v2.7.17, v2.7.18, v2.7.19, v2.7.2, v2.7.20, v2.7.21, v2.7.22, v2.7.3, v2.7.4, v2.7.5, v2.7.6, v2.7.7, v2.7.8, v2.7.9, v2.8.0, v2.8.1, v2.8.10, v2.8.11, v2.8.12, v2.8.13, v2.8.14, v2.8.15, v2.8.2, v2.8.3, v2.8.4, v2.8.5, v2.8.6, v2.8.7, v2.8.8, v2.8.9].
    - Can only install one of: symfony/console[v2.7.0, v3.0.2].
    ...
    - Can only install one of: symfony/console[v2.8.9, v3.0.2].
    - Installation request for symfony/console (locked at v3.0.2) -> satisfiable by symfony/console[v3.0.2].


Installation failed, deleting ./composer.json.

修改

composer global为什么选择symfony / console

Changed current directory to /home/self/.composer
consolidation/annotated-command  2.2.2   requires  symfony/console (^2.8|~3)    
consolidation/log                1.0.3   requires  symfony/console (~2.5|~3.0)  
consolidation/output-formatters  3.1.5   requires  symfony/console (~2.5|~3.0)  
consolidation/robo               1.0.5   requires  symfony/console (~2.8|~3.0)  
laravel/installer                v1.3.1  requires  symfony/console (~2.3|~3.0)  
victorjonsson/markdowndocs       1.3.7   requires  symfony/console (>=2.6) 

2 个答案:

答案 0 :(得分:2)

Composer中有一个非常酷的命令:composer why

我邀请您提供composer why symfony/console的结果。某种程度上某些东西将它锁定到特定版本(3.0.2),但WP的目标是旧版本......

如果您的工具存在冲突,则需要查看将wp-cli更改为symfony / console 3时会发生什么,然后在wp-cli上创建PR。如果需要,我可以指导您完成此过程。

答案 1 :(得分:2)

我能够通过删除全局composer.lock并运行composer global install

来解决问题