- 経緯
- ざっくり言うと、PHP公式 Docker の 7.1-fpm をベースに composer を追加した Docker イメージを作成していた
- その際、
composer install
時のエラーでハマったので備忘録
# composer install --dev Do not run Composer as root/super user! See https://getcomposer.org/root for details You are using the deprecated option "dev". Dev packages are installed by default now. Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Package operations: 84 installs, 0 updates, 0 removals Failed to download aura/installer-default from dist: The zip extension and unzip command are both missing, skipping. Your command-line PHP is using multiple ini files. Run `php --ini` to show them. Now trying to download from source - Installing aura/installer-default (1.0.0): Cloning 52f8de3670 [RuntimeException] Failed to clone https://github.com/auraphp/installer-default.git, git was not found, check that it is installed and in your PATH env. sh: 1: git: not found
エラー内容
下記 2 点
Failed to clone https://github.com/xxxx.git, git was not found
Failed to download xxxx from dist: The zip extension and unzip command are both missing
1. Failed to clone https://github.com/xxxx.git, git was not found
- 原因
- 対象コンテナに git がインストールされてない
- 解消方法
- Dockerfile に git をインストールする処理を追加
- 反省点
- 検討違いの調査をした事
Your command-line PHP is using multiple ini files
に着目してしまって、その辺りを調べていた
- 検討違いの調査をした事
2. Failed to download xxxx from dist: The zip extension and unzip command are both missing
- 原因
-
PHP の zipエクステンション
がインストールされてない -
OS の unzip コマンド
がインストールされてない
-
- 解消方法
-
zipエクステンション
をインストール (※ハマった事 を参照) - unzip コマンド` をインストール
-
- 反省点
- エラーメッセージの英文をよく読んでおらず、エラー内容を勘違いしていた
unzip command
が missing と書かれてにも関わらず、PHPの unzip エクステンション が足りないのだと勘違い
- エラーメッセージの英文をよく読んでおらず、エラー内容を勘違いしていた
- ハマった事
- zip エクステンションをインストールするタイミング
- Dockerfile に PHPエクステンションのビルドに必要な依存モジュールを、ビルドが終わって不要になったら削除する処理がある
- 上記を把握せずに、依存モジュール削除後に、zip エクステンションをインストールしようとした為、ビルドが失敗
- zip エクステンションをインストールするタイミング
困っている事
- エラー内容を正しく理解する前に、検討違いのキーワードでググったりと、遠回り(というか無駄な作業)をしまう。効率が悪い。無駄をなくしたい。