LoginSignup
0
0

More than 3 years have passed since last update.

MacでのLaravel6の環境構築でエラーが起こった件

Posted at

Laravelのインストールコマンドでエラーが起こった

Composerの準備をこちらの記事の手順で完了した後、
下記のLaravelのインストールをコマンドを実行。

$ composer global require laravel/installer

すると、下記のエラーが発生しました。

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - laravel/installer v3.0.0 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
    - laravel/installer v3.0.1 requires ext-zip * -> it is missing from your system. Install or enable PHP's zip extension.
    - Root composer.json requires laravel/installer ^3.0 -> satisfiable by laravel/installer[v3.0.1, v3.0.0].

You are using a snapshot build of Composer 2, which may be the cause of the problem. Run `composer self-update --stable` and then try again. In case it solves the problem, please report an issue mentioning Composer 2.

Installation failed, deleting ./composer.json.

スクリーンショット 2020-05-15 20.44.15.jpg

原因

エラー文から「ext-zip」というものが足りていないということがわかった。
試行錯誤して調べるうちに、HomebrewでPHPがインストールできていない可能性が浮上した。

試したこと

そこで、下記のコマンドでHomebrewでのPHP7.4のインストールを実行。

$ brew install php@7.4

このコマンド完了は5分程かかりました。
その後、再度下記のLaravelのインストールをコマンドを実行。

$ composer global require laravel/installer

すると、以下のようにうまくインストールできました。
この前後の環境構築に関してはこちらの記事をにまとめてあるので是非参考にしてください。

スクリーンショット 2020-05-15 21.28.22.jpg

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0