问题
On a server I want to do composer update/install and both give the error:
-bash: composer: command not found
I can see composer.phar, composer.json and composer.lock are there. How can I find out why I can't update?
Unfortunately the site is down at the moment because I get an error because one package isn't there at the moment.
UPDATE:
If I enter the following command:
php composer.phar install/update
everything seems to be working. Is there something I can do to change this or is it always necessary to enter the command this way?
回答1:
Composer is probably not installed on your machine.
Run this in your terminal to get the latest Composer version (Source):
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === '55d6ead61b29c7bdee5cccfb50076874187bd9f21f65d8991d46ec5cc90518f447387fb9f76ebae1fbbacf329e583e30') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"
Alternative way: https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx
来源:https://stackoverflow.com/questions/42012323/bash-composer-command-not-found