ふたりはララベル (Laravel PHP Framework)

PHPフレームワークのLaravelの体験記を書いていきます。こんなタイトルのブログですが萌え系アニメは一秒たりとも観たことがありません。

Composerのエラーの原因を調査する

プロキシが必要な環境でComposerを使う場合には

set HTTP_PROXY=http://ユーザ名:パスワード@プロキシのホスト:ポート番号

実行する。それでもcomposerが動かない場合がある。以下の様なエラーがでるときだ。

  [Composer\Downloader\TransportException]
  The "http://packagist.org/p/laravel/laravel$43a87xxx.json" file could not be downloaded (HTTP/1.0 404 Not Found)

こういう場合は「composer diag」コマンドで原因調査ができる。

composer diag
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity: OK
Checking HTTP proxy: OK
Checking HTTP proxy support for request_fulluri: FAIL
Unable to assert the situation, maybe packagist.org is down (The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.0 404 Not Found))
Checking HTTPS proxy support for request_fulluri: OK
Checking disk free space: OK
Checking composer version: OK

原因は

Checking HTTP proxy support for request_fulluri: FAIL

なので以下のコマンドで解決する。

set HTTP_PROXY_REQUEST_FULLURI=0