LaravelのアプリでReactを使いたくてLaravel UI
をインストールする際にエラーとなってしまいました。
その際の覚書きです。
実行環境
- macOS Catalina 10.15.7
- Composer 2.1.12
- Laravel 6.20.40
実行コマンドとエラー内容
実行コマンド
$ composer require laravel/ui
結果
Using version ^3.4 for laravel/ui
./composer.json has been updated
Running composer update laravel/ui
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.
Problem 1
- laravel/ui[v3.4.0, ..., 3.x-dev] require illuminate/console ^8.42|^9.0 -> found illuminate/console[dev-master, v8.42.0, ..., 8.x-dev, 9.x-dev (alias of dev-master)] but these were not loaded, likely because it conflicts with another require.
- Root composer.json requires laravel/ui ^3.4 -> satisfiable by laravel/ui[v3.4.0, 3.x-dev].
You can also try re-running composer require with an explicit version constraint, e.g. "composer require laravel/ui:*" to figure out if any version is installable, or "composer require laravel/ui:^2.1" if you know which you need.
Installation failed, reverting ./composer.json and ./composer.lock to their original content.
結論
調べたところ,Laravel UIとLaravelは対応するバージョンが決まっているようです。
Laravel UI | Laravel |
---|---|
1.x | 5.8、6.x |
2.x | 7.x |
3.x | 8.x |
自分の使ってるLaravel6.20.40
に対応したバージョン1.0
を指定してインストール
$ composer require laravel/ui:^1.0 --dev
無事インストールできました!
./composer.json has been updated
Running composer update laravel/ui
Loading composer repositories with package information
Updating dependencies
Lock file operations: 1 install, 0 updates, 0 removals
- Locking laravel/ui (v1.3.0)
Writing lock file
Installing dependencies from lock file (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
- Downloading laravel/ui (v1.3.0)
- Installing laravel/ui (v1.3.0): Extracting archive
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
Discovered Package: facade/ignition
Discovered Package: fideloper/proxy
Discovered Package: laravel/tinker
Discovered Package: laravel/ui
Discovered Package: nesbot/carbon
Discovered Package: nunomaduro/collision
Package manifest generated successfully.
68 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
余談
この後,Laravelのバージョンを7.30.5
に変更したので,Laravel UIのバージョンも2.0
に変更しました。