Error updating WP-CLI

时间:2017-03-27 作者:Robin Andrews

下面是我尝试在Windows 10上更新wp cli的结果。显然,另一个版本是可用的。有人能解释一下如何做到这一点吗?

C:\\Users\\HP>wp cli update
Error: You can only self-update Phar files.

C:\\Users\\HP>wp cli check-update
+---------+-------------+-----------------------------------------------------------------------------+
| version | update_type | package_url                                                                 |
+---------+-------------+-----------------------------------------------------------------------------+
| 1.1.0   | major       | https://github.com/wp-cli/wp-cli/releases/download/v1.1.0/wp-cli-1.1.0.phar |
+---------+-------------+-----------------------------------------------------------------------------+

1 个回复
SO网友:Sven

首先,找到WP-CLI的安装位置。

如果使用Composer,可以在命令行中列出所有全局安装的软件包,如下所示:

composer global show
然后更新WP-CLI composer包:

composer global update wp-cli/wp-cli
如果您使用的是自制软件,可以在命令行中列出所有已安装的软件包,如下所示:

brew list
并更新包:

brew upgrade wp-cli
此后,您应该能够通过内置命令升级到WP-CLI的下一个版本:

wp cli update
作为回报,您将得到如下提示:

You have version 1.4.1. Would you like to update to 1.5.0? [y/n]


Downloading from https://github.com/wp-cli/wp-cli/releases/download/v1.5.0...
New version works. Proceeding to replace.
Success: Updated WP-CLI to 1.5.0.