Linux Composer 安装/更新不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21055425/
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-08-07 01:49:57  来源:igfitidea点击:

Composer install/update not working

phplinuxgitcomposer-php

提问by Maksym Cierzniak

I have a problem with Composer Package Manager. System is Ubuntu 12.04. I just can't make it work. I pulled my git project and try to run 'composer install', but it seems that nothing actually happens. I just get an information

我有 Composer 包管理器的问题。系统是 Ubuntu 12.04。我只是无法让它发挥作用。我拉了我的 git 项目并尝试运行“composer install”,但似乎实际上什么也没发生。我只是得到一个信息

Installing dependencies (including require-dev)

then nothing actually happens. This is my log from this command run with -vvv parameter:

那么实际上什么也没发生。这是我使用 -vvv 参数运行的命令的日志:

here

这里

Does anyone have any idea what can be wrong ? I tried to clear cache, it did not help. I am sure this repo works well as I pulled it to my Windows machine and it downloaded everything just fine. 'composer diagnose' also returned OK. Thanks for any tips.

有谁知道什么是错误的?我试图清除缓存,它没有帮助。我确信这个 repo 运行良好,因为我把它拉到我的 Windows 机器上,它下载了一切。“作曲家诊断”也返回 OK。感谢您提供任何提示。

采纳答案by KLXN

In first place You should try clearing composer cache.

首先,您应该尝试清除作曲家缓存。

rm -rf ~/.composer/cache

But more probably it's issue connected with available memory. Increasing memory_limit should help.

但更可能是与可用内存有关的问题。增加 memory_limit 应该会有所帮助。

回答by Ahmad Sharif

Try with this one and make sure that the composer.json file exist in your project directory.

试试这个并确保 composer.json 文件存在于您的项目目录中。

COMPOSER=composer.json composer update 

回答by Jordi Galobart

Try to view a verbose report:

尝试查看详细报告:

composer install -vvv

or:

或者:

composer update -vvv

If last line shows that process is killed, you need to increase your swap memory:

如果最后一行显示进程被杀死,则需要增加交换内存:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=512k
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
swapon -s

if it continues killing the process, you need to increase 512k to 1024k or maybe 2048k

如果它继续杀死进程,则需要将 512k 增加到 1024k 或 2048k

回答by Jay

Though similar answer has already been posted above but still , if composer install / update is not working try doing composer diagnose.. please refer..

虽然上面已经发布了类似的答案,但仍然,如果 composer install / update 不起作用,请尝试进行 composer 诊断 .. 请参考..

https://getcomposer.org/doc/articles/troubleshooting.md

https://getcomposer.org/doc/articles/troubleshooting.md

worked for me after updating my composer.. also sometimes internet might be the issue.. Happy Coding! :D

更新我的作曲家后为我工作..有时互联网可能是问题..快乐编码!:D

回答by Oliver P

I had this issue and realised I had xdebug enabled. Disabling it fixed the issue for me.

我遇到了这个问题并意识到我启用了 xdebug。禁用它为我解决了这个问题。