无法在 Phpstorm 中为 composer 添加命令行工具支持
Unable to add command line tool support for the composer in Phpstorm
我在 Windows 10 上使用 PHPStorm,在 php.exe 上使用 WAMP 服务器,并且在 windows 上使用 ComposerSetup.exe 安装了 composer。我正在尝试为 Phpstorm 中的作曲家添加命令行工具支持,但它失败并出现此错误。
问题
无法将输出解析为 XML:第 2 行错误:序言中不允许包含内容。
命令
php.exe C:\ProgramData\ComposerSetup\bin\composer 列表--xml
输出
dir=$(d=$(dirname "[=10=]"); cd "$d" && pwd)
# see if we are running in cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin.
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
php "${dir}/composer.phar" $*
PHPStorm 应该知道本地安装的 PHP,它所需要的只是 composer.phar
包含 Composer PHP 源代码的文件。
您提供的内容 PHPStorm 看起来像一个 Windows 批处理文件,它检测在 Windows shell 中被调用的某些方面(例如 CMD 与 Cygwin),然后调用PHP 路径为 composer.phar
。这不是您可以直接提供给 PHP 的 PHP 源代码,就像 PHPStorm 那样。
只配置PHPStorm中phar文件的路径,不配置那个批处理文件。
或者,您可以简单地通过 PHPStorm GUI 添加 Composer - 如果 Composer 未知,它会要求您提供它,并且应该提供下载可能性。
只需通过谷歌搜索即可在他们的网站上找到大量帮助文本 "phpstorm install composer":https://www.jetbrains.com/phpstorm/help/using-composer-dependency-manager.html
我在 Windows 10 上使用 PHPStorm,在 php.exe 上使用 WAMP 服务器,并且在 windows 上使用 ComposerSetup.exe 安装了 composer。我正在尝试为 Phpstorm 中的作曲家添加命令行工具支持,但它失败并出现此错误。
问题 无法将输出解析为 XML:第 2 行错误:序言中不允许包含内容。 命令 php.exe C:\ProgramData\ComposerSetup\bin\composer 列表--xml 输出
dir=$(d=$(dirname "[=10=]"); cd "$d" && pwd)
# see if we are running in cygwin by checking for cygpath program
if command -v 'cygpath' >/dev/null 2>&1; then
# cygwin paths start with /cygdrive/ which will break windows PHP,
# so we need to translate the dir path to windows format. However
# we could be using cygwin PHP which does not require this, so we
# test if the path to PHP starts with /cygdrive/ rather than /usr/bin.
if [[ $(which php) == /cygdrive/* ]]; then
dir=$(cygpath -m $dir);
fi
fi
dir=$(echo $dir | sed 's/ /\ /g')
php "${dir}/composer.phar" $*
PHPStorm 应该知道本地安装的 PHP,它所需要的只是 composer.phar
包含 Composer PHP 源代码的文件。
您提供的内容 PHPStorm 看起来像一个 Windows 批处理文件,它检测在 Windows shell 中被调用的某些方面(例如 CMD 与 Cygwin),然后调用PHP 路径为 composer.phar
。这不是您可以直接提供给 PHP 的 PHP 源代码,就像 PHPStorm 那样。
只配置PHPStorm中phar文件的路径,不配置那个批处理文件。
或者,您可以简单地通过 PHPStorm GUI 添加 Composer - 如果 Composer 未知,它会要求您提供它,并且应该提供下载可能性。
只需通过谷歌搜索即可在他们的网站上找到大量帮助文本 "phpstorm install composer":https://www.jetbrains.com/phpstorm/help/using-composer-dependency-manager.html