はじめに
macOSでの話です。
Laravel公式のインストールサイト(日本語訳)通りに進んでいたが、
composer global require laravel/installer
の入力が上手くいかず、下記のエラーが出て数時間つまづいたので誰かの役に立ったらと思い書きます。
Your requirements could not be resolved to an installable set of packages.
Problem 1
Installation request for laravel/installer ^2.1 -> satisfiable by laravel/installer[v2.1.0].
laravel/installer v2.1.0 requires ext-zip * -> the requested PHP extension zip is missing from your system.
どのようにエラーを取ったか
同じ症状で悩んでいる人が teratailにいたので質問していたのでその回答通りにやってみました。(pecl install zip は peclコマンドが使えなかったのでスルーした。)
brew で phpを入れるのは、https://laracasts.com/series/laravel-6-from-scratch/episodes/1 の動画サイトを1~3まで見ればわかります。
同じ症状で悩んでいる人書いてくれている
brew link php
を実行する。
そうすると、
Linking /usr/local/Cellar/php/7.4.1...
Error: Could not symlink bin/pear
Target /usr/local/bin/pear
already exists. You may want to remove it:
rm '/usr/local/bin/pear'
To force the link and overwrite all conflicting files:
brew link --overwrite php
To list all files that would be deleted:
brew link --overwrite --dry-run php
というエラーが出てくるので
brew link --overwrite php
を実行、そして再起動してcomposer global require laravel/installer
を実行して完了です。
補足
・・・composerのダウンロード
https://kohkimakimoto.github.io/getcomposer.org_doc_jp/doc/00-intro.html
これを手順に
composerの使い方。composer.jsonやcomposer.pharを使わなきゃいけなくなった時このサイトを勝つよすると良い。https://laboradian.com/php-composer/