[PHP]Composer実行時に、エラー「sh: git: command not found」が発生する

カテゴリ: composer

事象

PHPのComposerを実行時に、エラー「sh: git: command not found」が発生した。

[vagrant@localhost www]$ composer create-project fuel/fuel blog
Installing fuel/fuel (1.8.0.1)
    Failed to download fuel/fuel 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 fuel/fuel (1.8.0.1): Cloning b36de3baa2


  [RuntimeException]                                                                                                     
  Failed to clone https://github.com/fuel/fuel.git, git was not found, 
  check that it is installed and in your PATH env.  

  sh: git: command not found                                                                                             


create-project [-s|--stability STABILITY] [--prefer-source] [--prefer-dist] 
[--repository REPOSITORY] [--repository-url REPOSITORY-URL] [--dev] [--no-dev] 
[--no-custom-installers] [--no-scripts] [--no-progress] [--no-secure-http] 
[--keep-vcs] [--remove-vcs] [--no-install] [--ignore-platform-reqs] [--] 
[<package>] [<directory>] [<version>]

原因

新しく作ったCentOSの環境で、gitコマンドをインストールし忘れていた。

解決方法

CentOSの場合、以下のコマンドでgitコマンドをインストールして、再度composerコマンドを実行すれば良い。

sudo yum install git -y
こちらもおススメ

コメントを残す

メールアドレスが公開されることはありません。