bash:作曲家:找不到命令

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/42012323/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 15:42:17  来源:igfitidea点击:

bash: composer: command not found

phpbashcomposer-php

提问by Graham

On a server I want to do composer update/install and both give the error:

在服务器上,我想做 composer update/install 并且都给出错误:

-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?

我可以看到 composer.phar、composer.json 和 composer.lock 都在那里。如何找出无法更新的原因?

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?

一切似乎都在工作。我可以做些什么来改变这一点,还是总是需要以这种方式输入命令?

回答by Chin Leung

Composer is probably not installed on your machine.

您的计算机上可能未安装 Composer。

Run this in your terminal to get the latest Composer version (Source):

在您的终端中运行它以获取最新的 Composer 版本(源代码):

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: //getcomposer.org/doc/00-intro.md#installation-linux-unix-osx