概要
laravelをインストールしてるんだけどできない!
ちょっと理由がありMAMPを使っていたら、問題発生!解決策を見つけるぞ!
と思って沢山対策を調べましたが全然なかったので、記事にしました。
バージョン
- laravel 9.x
- composer 2.5.8
- php 8.1
エラー内容
laravel/framework[v9.36.4, ..., 9.x-dev] require league/flysystem ^3.8.0 -> satisfiable by league/flysystem[3.8.0, ..., 3.x-dev].
- laravel/framework[v9.18.0, ..., v9.36.3] require league/flysystem ^3.0.16 -> satisfiable by league/flysystem[3.0.16, ..., 3.x-dev].
- laravel/framework[v9.0.0-beta.2, ..., v9.17.0] require league/flysystem ^3.0 -> satisfiable by league/flysystem[3.0.0, ..., 3.x-dev].
- league/flysystem[2.3.1, ..., 2.x-dev, 3.0.0, ..., 3.14.0] require league/mime-type-detection ^1.0.0 -> satisfiable by league/mime-type-detection[1.0.0, ..., 1.11.0].
- league/flysystem[3.15.0, ..., 3.x-dev] require league/flysystem-local ^3.0.0 -> satisfiable by league/flysystem-local[3.15.0, 3.x-dev].
- league/mime-type-detection[1.0.0, ..., 1.3.0] require php ^7.2 -> your php version (8.1.0) does not satisfy that requirement.
- league/mime-type-detection[1.4.0, ..., 1.11.0] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- league/flysystem-local[3.15.0, ..., 3.x-dev] require ext-fileinfo * -> it is missing from your system. Install or enable PHP's fileinfo extension.
- Root composer.json requires laravel/framework ^9.0 -> satisfiable by laravel/framework[v9.0.0-beta.1, ..., 9.x-dev].
To enable extensions, verify that they are enabled in your .ini files:
- C:\MAMP\bin\php\php8.1.0\php.ini
You can also run `php --ini` in a terminal to see which files are used by PHP in CLI mode.
Alternatively, you can run Composer with `--ignore-platform-req=ext-fileinfo` to temporarily ignore these required extensions.
ざっと訳しますと、
インストールをするための必要なバージョンが足りません。とplatform-req=ext-fileinfo`を使えるようにして下さい。とあります。
1週間以上格闘
laravel再インストールをしたり、composerを入れ直したりと、試行錯誤を重ねましたが無理ですね。とplatform-req=ext-fileinfoを使えるようにしましたが、下記のエラーが出てきました、
このエラーでxamppに変更
ドライバが見つかりませんでした(SQL: select * from information_schema.tables where table_schema = laravel_task and table_name = migrations and table_type = 'BASE TABLE')
ドライバーがインストールされていません。とエラーが出てようやくxamppに乗り換えました。おそらくですが、WindowsのMAMPには必要なドライバが足りていなかった可能性がありますね。
MacはMAMP、WindowsはXAMPPと言われている理由が納得できました。
結論
MacはMAMP、WindowsはXAMPPを使いましょう。
初記事なので読みにくかったらごめんなさい!
参考になれば幸いです!