Windows WP-CLI软件包目录丢失 [英] Windows WP-CLI packages directory missing

查看:57
本文介绍了Windows WP-CLI软件包目录丢失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过在Windows上安装了wp-cli 作为全局要求的href = https://make.wordpress.org/cli/handbook/installing/#installing-via-composer rel = nofollow noreferrer> composer 命令 composer global require wp-cli / wp-cli 并获得OK的输出。

Installed wp-cli on Windows via composer as global require with command composer global require wp-cli/wp-cli and get OK output like so.

D:\>composer global require wp-cli/wp-cli
Changed current directory to C:/Users/User/AppData/Roaming/Composer
Using version ^1.2 for wp-cli/wp-cli
./composer.json has been created
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 51 installs, 0 updates, 0 removals
  - Installing wp-cli/autoload-splitter (v0.1.3): Downloading (100%)
  - Installing wp-cli/php-cli-tools (v0.11.2): Downloading (100%)
  - Installing wp-cli/mustangostang-spyc (0.6.3): Downloading (100%)
  - Installing composer/semver (1.4.2): Downloading (100%)
  - Installing mustache/mustache (v2.11.1): Downloading (100%)
  - Installing ramsey/array_column (1.1.3): Downloading (100%)
  - Installing rmccue/requests (v1.7.0): Downloading (100%)
  - Installing symfony/filesystem (v3.3.2): Downloading (100%)
  - Installing symfony/config (v3.3.2): Downloading (100%)
  - Installing psr/log (1.0.2): Downloading (100%)
  - Installing symfony/debug (v3.3.2): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.3.0): Downloading (100%)
  - Installing symfony/console (v3.3.2): Downloading (100%)
  - Installing psr/container (1.0.0): Downloading (100%)
  - Installing symfony/dependency-injection (v3.3.2): Downloading (100%)
  - Installing symfony/event-dispatcher (v3.3.2): Downloading (100%)
  - Installing symfony/finder (v3.3.2): Downloading (100%)
  - Installing symfony/process (v3.3.2): Downloading (100%)
  - Installing symfony/translation (v3.3.2): Downloading (100%)
  - Installing symfony/yaml (v3.3.2): Downloading (100%)
  - Installing wp-cli/cache-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/checksum-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/config-command (v1.1.1): Downloading (100%)
  - Installing wp-cli/core-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/cron-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/widget-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/super-admin-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/wp-cli (v1.2.1): Downloading (100%)
    Skipped installation of bin bin/wp.bat proxy for package wp-cli/wp-cli: a .bat proxy was already installed
  - Installing wp-cli/shell-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/server-command (v1.0.5): Downloading (100%)
  - Installing wp-cli/search-replace-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/scaffold-command (v1.0.4): Downloading (100%)
  - Installing wp-cli/role-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/rewrite-command (v1.0.1): Downloading (100%)
  - Installing seld/phar-utils (1.0.1): Downloading (100%)
  - Installing seld/jsonlint (1.6.0): Downloading (100%)
  - Installing seld/cli-prompt (1.0.3): Downloading (100%)
  - Installing justinrainbow/json-schema (5.2.1): Downloading (100%)
  - Installing composer/spdx-licenses (1.1.6): Downloading (100%)
  - Installing composer/ca-bundle (1.0.7): Downloading (100%)
  - Installing composer/composer (1.4.2): Downloading (100%)
  - Installing wp-cli/package-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/media-command (v1.0.2): Downloading (100%)
  - Installing wp-cli/language-command (v1.0.2): Downloading (100%)
  - Installing wp-cli/import-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/extension-command (v1.1.0): Downloading (100%)
  - Installing nb/oxymel (v0.1.0): Downloading (100%)
  - Installing wp-cli/export-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/eval-command (v1.0.1): Downloading (100%)
  - Installing wp-cli/entity-command (v1.0.2): Downloading (100%)
  - Installing wp-cli/db-command (v1.1.0): Downloading (100%)
symfony/dependency-injection suggests installing symfony/expression-language (For using expressions in service container
 configuration)
symfony/dependency-injection suggests installing symfony/proxy-manager-bridge (Generate service proxies to lazy load the
m)
symfony/event-dispatcher suggests installing symfony/http-kernel ()
wp-cli/wp-cli suggests installing psy/psysh (Enhanced `wp shell` functionality)
Writing lock file
Generating autoload files

D:\>

但是当我用 wp --info检查wp-cli安装我缺少 WP-CLI软件包dir

D:\>wp --info
PHP binary:     D:\XAMPP\php\php.exe
PHP version:    5.6.8
php.ini used:   D:\XAMPP\php\php.ini
WP-CLI root dir:        phar://wp-cli.phar
WP-CLI packages dir:
WP-CLI global config:
WP-CLI project config:
WP-CLI version: 1.1.0

想要使用此命令

wp软件包安装iandunn / wp-cli-rename-db-prefix

但是出现以下错误:

错误:无法创建软件包的Composer目录。

我的PATH有这些变量。

My PATH has these variables.

C:\Users\User\AppData\Roaming\npm; D:\XAMPP\php; C: \用户\用户\AppData\漫游\Composer\供应商\bin; D:\XAMPP\mysql

如何确保使用composer使用全局require安装方法设置wp-cli的软件包目录?

How can I make sure the packages directory for wp-cli is set using the global require install method with composer please?

推荐答案

我不必在Windows环境变量中设置PATH值,而是创建一个名为 WP_CLI_PACKAGES_DIR 新变量,并将该变量的值设置为 C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.wp-cli\packages

Instead of setting a PATH value in the Windows environment variables I had to make a new variable called WP_CLI_PACKAGES_DIR and set the value of that variable to C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.wp-cli\packages.

我还必须创建 C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.wp-cli\ 下的文件夹 packages 。该文件夹不是自动创建的。

I also had to create the folder packages under C:\Users\YOUR_WINDOWS_YOURSERNAME_HERE\.wp-cli\. The folder was not created automatically.

现在,我可以很好地安装wp-cli软件包,运行它,并且也可以正常工作。

Now I could install the wp-cli package just fine, ran it and it also worked perfectly.

https://make.wordpress.org/ cli / handbook / config /#environment-variables

这篇关于Windows WP-CLI软件包目录丢失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆