[Composer]Warning from https://packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2

Laravelのプロジェクトを作ろうとしたらcomposerを2.0にバージョンアップしろと。

% composer create-project laravel/laravel example-project
Warning from https://packagist.org: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2

バージョンを確認してみる。

% composer --version
Composer version 1.6.4 2018-04-13 12:04:24

確かに古いな。
self-updateしてみる。

% sudo composer self-update
Password:
You are running composer as "root", while "/Users/xxxxx/.composer" is owned by "xxxxx"
Updating to version 2.0.8 (stable channel).

怒られた…sudoしたらダメだったわ。

% composer self-update
Updating to version 2.0.8 (stable channel).
   Downloading (100%)


  [RuntimeException]
  SHA384 is not supported by your openssl extension, could not verify the phar file integrity


self-update [-r|--rollback] [--clean-backups] [--no-progress] [--update-keys] [--stable] [--preview] [--snapshot] [--set-channel-only] [--] [<version>]

なんなん?
まぁ結局、最新版を普通にインストールしろってことになる。

%bphp -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
% php -r "if (hash_file('sha384', 'composer-setup.php') === '756890a4488ce9024fc62c56153228907f1545c228516cbf63f885e036d37e9a59d27d63f46af1d4d07ee0f76181c7d3') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
Installer verified
% php composer-setup.php

All settings correct for using Composer
Downloading...

Composer (version 2.0.8) successfully installed to: /Users/xxxxx/composer.phar
Use it: php composer.phar

% php -r "unlink('composer-setup.php');"
% mv composer.phar /usr/local/bin/composer
% composer --version
Composer version 2.0.8 2020-12-03 17:20:38

はい。できました。

コメント

タイトルとURLをコピーしました