2015-11-10 27 views
6

wesiteで説明されているように、phpで作者をインストールしようとしています。作者のインストールエラー - 出力はttyではありません。入力はttyではありません。

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

しかし、それは次のようなエラーが表示されます。Windows 7で

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

私はこのコマンドを実行するためのgit bashのを使用。 Windowsのコマンドプロンプトで、それは正常に動作しています。この問題は、git bash 2.6.2-64bitからこのコマンドを実行した場合にのみ発生します。

私はWindows用のコンポーザーをインストールしており、うまくいきます。しかし、私はこの方法でcomposer.pharをダウンロードすることはできません。この問題を解決するにはどうすればよいですか?これは、PATHやエンコーディングの問題になる可能性が

+0

が見える必要。しかし、あなたが話している指示へのリンクがなければ、それを確認するのは難しいです。 –

+0

はい、Johnston、私はWindowsのコマンドプロンプトから使用するとうまくいきます。私はちょうどテストしたが、git bashで作業していない。あなたはそれがgit bashの問題だと思いますか?しかし、私はgit bashでこれを使うこともできました(他のコンピュータ/他のgit bash版)。 –

答えて

6

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) 
    
  • をUNALIASすることを提案します

しかし:

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/[email protected] , #399 and #400 to understand what havoc you would wreak by simply removing those aliases.

だから今、bashのコンソールは、プログラムがWin32コンソール用を必要とする場合に必要と思わwinpty、恩恵を受けるいない可能性があります第二| phpとして(パイプを通してphpを実行すると互換性がありませんインタラクティブな使用法)。 in the commentsアウト

Pehポイント:

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

bash.exegit-bash.exeに反しwinptyを、使用していないので、おそらくです。

+6

'C:\ Program Files \ Git \ git-bash.exe'の代わりに' C:\ Program Files \ Git \ bin \ bash.exe'を使用すると、コマンドは正常に動作します。私は[ConsoleZ](https://github.com/cbucher/console)と組み合わせて問題なく使用しています。 –

+0

@Pehこのフィードバックをいただきありがとうございます。私はより多くの可視性のために答えにそれを含めました。 – VonC

+0

VoncとPehに感謝します。 –

2

VonCの回答は正しいですし、将来的に他の人を助けるために私はより視覚的な解決策を提供したいと思います。あなたは今、コマンドプロンプトが表示されるはずです\プログラムファイル\のGit \ binに

  • bash.exe
  • enter image description here

    • をダブルクリックしてください:Cへの移動が

      • PHPプロジェクトディレクトリに移動し、Composerをインストールします。

        $でcd C:\パス\は

        $は-sS https://getcomposer.org/installerカールあなたの\プロジェクト\します| PHP

        $のLS

      • ファイルcomposer.pharは、プロジェクトのルートに表示されるようになりました。

      • コンポーザーにパッケージをインストールします。

        $ PHPのcomposer.pharは問題はあなたがGitのはbashからではなく、Windowsのコマンドラインからコマンドを実行しているということであるかのように、いくつかのパッケージ - あなた-希望にインストールできる

    +0

    いいえイラスト。 +1 – VonC

    関連する問題