gpt4 book ai didi

php - Composer 安装错误 - 输出不是 tty,输入不是 tty

转载 作者:可可西里 更新时间:2023-11-01 12:47:18 26 4
gpt4 key购买 nike

我正在尝试通过 php 安装 composer,如他们的网站所述。

php -r "readfile('https://getcomposer.org/installer');" | php

但它显示以下错误:

$ php -r "readfile('https://getcomposer.org/installer');" | php
output is not a tty
input is not a tty

我在 Windows 7 中使用 git bash 来执行这个命令。在 Windows 命令提示符下,它工作正常。仅当我从 git bash 2.6.2-64 位运行此命令时才会出现此问题。

顺便说一句,我已经为 windows 安装了 composer,并且工作正常。但是我无法通过这种方式下载 composer.phar。我该如何解决这个问题?

最佳答案

可能是 PATH 或编码问题:

it seems that git ls-remote origin, run from a freshly-built and installed MinGW Git fails to be able to output anything, and git ls-remote origin | cat (a trick learned from working with old MSys'/MinGW's quirks) only says: output is not a tty (the exit code is 127, suggesting that some executable was not found, but it is very difficult to say which one because not even debug print statements to stderr are shown; It seems that in case of a crash or of a die(), stderr is not flushed)

  • issue 519甚至建议取消别名 winpty

      unalias $(alias | grep winpty | cut -d"=" -f1 | cut -d" " -f2)

但是:

No, we cannot simply abandon winpty. PHP can be run interactively, i.e. it requires a proper Win32 Console. Running PHP without winpty in MinTTY would not provide that Console instance, leaving you with a seemingly unresponsive terminal.

See git-for-windows/build-extra@44ed99b, #399 and #400 to understand what havoc you would wreak by simply removing those aliases.

所以现在,bash 控制台与通过管道执行 php 不兼容(因为第二个 | php 可能无法从 winpty 中受益,当程序需要 Win32 控制台进行交互式使用时,这似乎是必需的)。

Peh指出in the comments :

If you use C:`Program Files\Git\bin\bash.exeinstead ofC:\Program Files\Git\git-bash.exe`, then the command works fine.
I'm using it in combination with ConsoleZ without any problems

这可能是因为 bash.exe 不使用 winpty,与 git-bash.exe 相反。

关于php - Composer 安装错误 - 输出不是 tty,输入不是 tty,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33622087/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com