加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 站长学院 > PHP教程 > 正文

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

发布时间:2020-12-13 13:30:09 所属栏目:PHP教程 来源:网络整理
导读:我正在尝试通过php安装composer,如他们的wesite所述. php -r "readfile('https://getcomposer.org/installer');" | php 但它显示以下错误: $php -r "readfile('https://getcomposer.org/installer');" | phpoutput is not a ttyinput is not a tty 我在Wind
我正在尝试通过php安装composer,如他们的wesite所述.
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-64bit运行此命令时才会出现此问题.

顺便说一下,我已经为windows安装了composer,这很好用.但我无法以这种方式下载composer.phar.我该如何解决这个问题?

它可以是PATH或编码问题:

> issue 25提到:

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甚至建议unalias 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 07002,07003 and 07004 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 FilesGitbinbash.exeinstead ofC:Program FilesGitgit-bash.exe`,then the command works fine.
I’m using it in combination with 07007 without any problems

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读