はじめに
XserverでEC-CUBEを簡単インストールして会員ランクプラグイン(CustomerRank42)を導入しようとした際に発生するエラーの解決方法を紹介します。このエラーは、PHP拡張モジュール「sodium」が不足していることが原因で発生します。
発生したエラー
会員ランクプラグインをインストールしようとすると、以下のようなエラーが表示されます:
**************** CustomerRank42 ****************
<warning>A script named compile would override a Composer command and has been skipped</warning>
<warning>A script named auto-scripts would override a Composer command and has been skipped</warning>
<warning>A script named installer-scripts would override a Composer command and has been skipped</warning>
[12.1MiB/4.28s] ./composer.json has been updated
[13.5MiB/4.32s] Running composer update ec-cube/customerrank42 --with-dependencies
[16.7MiB/4.33s] Loading composer repositories with package information
[17.7MiB/9.11s] <warning>Dependency ec-cube/plugin-installer is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.</warning>
[18.0MiB/9.12s] Updating dependencies
[19.9MiB/9.14s] Your requirements could not be resolved to an installable set of packages.
[19.9MiB/9.14s]
Problem 1
- lcobucci/jwt 5.3.0 requires ext-sodium * -> it is missing from your system. Install or enable PHP's sodium extension.
- league/oauth2-server-bundle v0.5.0 requires league/oauth2-server ^8.3 -> satisfiable by league/oauth2-server[8.5.4].
- ec-cube/api42 4.3.1 requires league/oauth2-server-bundle ^0.5 -> satisfiable by league/oauth2-server-bundle[v0.5.0].
- league/oauth2-server 8.5.4 requires lcobucci/jwt ^4.3 || ^5.0 -> satisfiable by lcobucci/jwt[5.3.0].
- ec-cube/api42 is locked to version 4.3.1 and an update of this package was not requested.
結論
解決方法:composer.jsonから"ec-cube/api42": "^4.3",
の行を削除するだけ
XserverでEC-CUBEに会員ランクプラグイン(CustomerRank42)を導入しようとした際に発生するエラーは、composer.jsonファイルから不要なAPI機能の依存関係を削除することで簡単に解決できます。
問題の原因
エラーメッセージを読み解くと:
-
lcobucci/jwt 5.3.0
というパッケージがext-sodium
(PHP Sodium拡張)を必要としている - この拡張モジュールがシステムにインストールされていない
- 依存関係の連鎖:
-
ec-cube/api42
がleague/oauth2-server-bundle
を必要とする - それが
league/oauth2-server
を必要とする - さらに
lcobucci/jwt
を必要とする - 最終的に
ext-sodium
が必要になる
-
解決方法
Xserverでは一般的にPHP拡張モジュールを自分でインストールすることはできませんが、この問題には簡単な解決方法があります。
解決方法:composer.jsonからec-cube/api42を削除する
- EC-CUBEのルートディレクトリにある
composer.json
ファイルを開きます - 以下の行を見つけて削除します:
"ec-cube/api42": "^4.3",
なぜこれで解決するのか?
EC-CUBEのAPI機能を使用していない場合、ec-cube/api42
パッケージは不要です。このパッケージを削除することで、Sodium拡張モジュールに依存する依存関係のチェーンを断ち切ることができます。会員ランクプラグインは直接この機能に依存していないため、API機能を削除しても問題なく動作します。
注意点
- EC-CUBEのAPI機能(REST API)を使用している場合は、この方法は適用できません
- API機能を使用している場合は、Xserverにサポートチケットを送信して、sodium拡張モジュールの有効化を依頼するか、別の方法を模索する必要があります
まとめ
Xserver上でEC-CUBEの会員ランクプラグイン(CustomerRank42)をインストールする際に発生するエラーは、不要なAPI機能の依存関係を削除することで簡単に解決できます。EC-CUBEのAPI機能を使用していない場合は、composer.jsonから"ec-cube/api42": "^4.3",
を削除するだけで問題が解決します。
この方法でエラーなくプラグインがインストールでき、会員ランク機能を使用できるようになります。
参考