LoginSignup
0
0

More than 3 years have passed since last update.

laravelを使ったときにハマったエラーの解決方法

Posted at

状況

laravel new laravelapp

Macでlaravelをインストールして上記のlaravelコマンドを使おうとするとこんなエラーが出た。

[RuntimeException]                                                       
The Zip PHP extension is not installed. Please install it and try again. 

こちらのエラーの解消に大分時間を費やしたので、同じエラーにハマってる人のために記事を残しておこうと思う。

解決方法

composerのインストール

まずはcomposerをインストールする
下記をターミナルで実行する

brew install composer

composerコマンドを代わりに使う

laravel new laravelapp

macの場合これでは無理なので代わりに,composer経由で行う。

composer create-project --prefer-dist laravel/laravel test_app

test_appは作りたいアプリ名。

このコマンドが使えない場合はパスが通ってない可能性があるので、下記を実行してください。

echo "export PATH=~/.composer/vendor/bin:$PATH" >> ~/.zprofile
source ~/.zprofile

解決方法2

composerコマンドを使って自分の場合は解決できたのですが、それでは解決できないこともあるかもしれません。

そういう場合はdockerを使うことを勧めます。

こちらを参考に環境構築してください。

参考記事

エラーについて調べた際に出てきた記事
https://qiita.com/endeavor/items/77f7017473c95c42fc29
https://iiiso.ti-da.net/e8647248.html

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