问题描述
我遇到了一个问题,我试图在我的 Laravel 4 项目中安装一个新包.但是当我运行 php composer.phar update 我得到这个:
I got a problem, I tried to install a new package to my Laravel 4 project.
But when I run php composer.phar update I get this:
Loading composer repositories with package information
Updating dependencies (including require-dev)
Killed
我在 Internet 上查找了问题,发现内存是问题,我认为我没有足够的 RAM 可用,我检查了这个我有大约 411mb 可用空间.composer 真的需要更多内存吗?
I have looked for the problem in the Internet and saw that the memory is the problem, I think I don't have enough RAM available, I've checked this I have about 411mb free. Does composer really need more RAM?
推荐答案
被杀"消息通常意味着您的进程消耗了太多内存,因此您可能只需要在可能的情况下向系统添加更多内存.在撰写此答案时,我必须将虚拟机的内存增加到至少 768MB,以使 composer update 在某些情况下正常工作.
The "Killed" message usually means your process consumed too much memory, so you may simply need to add more memory to your system if possible. At the time of writing this answer, I've had to increase my virtual machine's memory to at least 768MB in order to get composer update to work in some situations.
但是,如果您在实时服务器上执行此操作,则根本不应该使用 composer update.你应该做的是:
However, if you're doing this on a live server, you shouldn't be using composer update at all. What you should instead do is:
- 在内存限制不那么严重的本地环境中运行
composer update. - 上传或
git pushcomposer.lock 文件. - 在实时服务器上运行
composer install.
- Run
composer updatein a local environment (such as directly on your physical laptop/desktop, or a docker container/VM running on your laptop/desktop) where memory limitations shouldn't be as severe. - Upload or
git pushthe composer.lock file. - Run
composer installon the live server.
composer install 然后将从 .lock 文件中读取,每次都获取完全相同的版本,而不是查找每个包的最新版本.这会降低您的应用崩溃的可能性,并且 composer 使用更少的内存.
composer install will then read from the .lock file, fetching the exact same versions every time rather than finding the latest versions of every package. This makes your app less likely to break, and composer uses less memory.
在此处阅读更多信息:https://getcomposer.org/doc/01-basic-usage.md#installing-with-composer-lock
或者,您可以将整个 vendor 目录上传到服务器,完全无需运行 composer install,但是您应该 运行 composer dump-autoload --optimize.
Alternatively, you can upload the entire vendor directory to the server, bypassing the need to run composer install at all, but then you should run composer dump-autoload --optimize.
这篇关于更新时作曲家被杀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!



大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)