bash: composer: command not found

南楼画角 提交于 2021-01-24 08:20:46

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!