0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Laravel/ui を XREA free で実装した話

Posted at

動機

Laravel にはログイン機能を簡単に実装出来る Laravel/ui があることを知りました。(ログイン機能の他にも色々あるとは思いますが。)
実装しようとしたのですが、エラーが発生しました。

初めに

laravel/ui を使うには Laravel 6 以上が必要です。Laravel 6 には php 7.2 以上が必要です。
Laravel の実装は別の記事1で書いたのでそちらを参考にして下さい。(実装についての記事は他の人が書いたものもあるので、分かりにくければそっちを参照してください。)

本題

XREA で Laravel/ui をインストールしようとして、以下のエラーが発生しました。

$ php72cli ../composer.phar require laravel/ui:^1.0 --dev
./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
    - phpunit/phpunit[8.5.8, ..., 8.5.x-dev] require ext-xmlwriter * -> it is missing from your system. Install or enable PHP's xmlwriter extension.
    - phpunit/phpunit[9.3.9, ..., 9.5.x-dev] require php >=7.3 -> your php version (7.2.34) does not satisfy that requirement.
    - phpunit/phpunit[9.3.3, ..., 9.3.8] require php ^7.3 || ^8.0 -> your php version (7.2.34) does not satisfy that requirement.
    - Root composer.json requires phpunit/phpunit ^8.5.8|^9.3.3 -> satisfiable by phpunit/phpunit[8.5.8, ..., 8.5.x-dev, 9.3.3, ..., 9.5.x-dev].

To enable extensions, verify that they are enabled in your .ini files:
    - /usr/local/apache2/conf/php72/php.ini
You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

Installation failed, reverting ./composer.json to its original content.

エラーについて調べる23と、Problem 1 の次の文中 ext-xmlwriter が問題らしい。
ext=extension=拡張機能の xmlwriter が足りないそう。

エラー除去に向けて

ということで、xmlwriter を使えるようにする方法を調べました。4
php72.ini を調べると extension_dir = "/usr/local/lib/php/extensions/" を発見しました。
ディレクトリの中身を見てみると

$ ls /usr/local/lib/php/extensions/
imagick.so        php72_opcache.so    php74_imagick.so    php80_xmlreader.so
imagick_php53.so  php73_imagick.so    php74_opcache.so    php80_xmlwriter.so
php55_opcache.so  php73_opcache.so    php74_xmlreader.so
php56_opcache.so  php73_xmlreader.so  php74_xmlwriter.so
php71_opcache.so  php73_xmlwriter.so  php80_opcache.so

う~ん、php72には xmlreader が無さそう。インストールしてもいいけど、環境を壊すと戻せなくなるかも……。
php73 以上にはあるみたいなので、そっちで実行してみることにしました。
(改めてエラーコードを見ると php73 以上を要求されています。こういうことだったんですね。)

$ php73cli ../composer.phar require laravel/ui:^1.0 --dev

実行してみると一応インストールは成功!(laravel/ui だけ別の php でインストールして不具合が出そうで不安ですが、まあ、失敗したら php73 で Laravel 6 のインストールからやり直せばいいので。)

$ php73cli artisan ui vue --auth
$ npm install
$ npm run dev

そのまま実装に必要なコマンドを打ちました。56
上手くいくかと思ったら、npm install の段階でエラーが発生しました。
というのも忘れていたのですが、ログイン機能の実装には 2G のメモリが必要で XREA free では足りません。
したがって、色々ややこしいことをしたのですが、XREA free 上でそのまま実装することは出来ません。(スワップ領域を使えば何とかなるそう7ですが、それもまた大変そう……)

結論

結局、ローカル環境で実装したものを FTP で転送することにしました。
スワップ領域を使った方が簡単だったよ、って人はやり方を教えてください。

  1. https://qiita.com/okada1220/items/b71710683de8f5368cf2

  2. https://napi-nami.hatenablog.com/entry/2021/02/28/092540

  3. https://qiita.com/wallkickers/items/e895495172b5e7371f38

  4. https://ymknjugg.hatenablog.com/entry/2019/06/16/113942

  5. https://qiita.com/daisu_yamazaki/items/b946594896179abcd203

  6. https://qiita.com/RealXiaoLin/items/a5ab2e11ae016f2ac6fb

  7. https://qiita.com/k_ui/items/6959a6c2975770dbc730

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?