Composer killed while updating(更新时作曲家被杀)
问题描述
我遇到了一个问题,我试图在我的 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 push
composer.lock 文件. - 在实时服务器上运行
composer install
.
- Run
composer update
in 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 push
the composer.lock file. - Run
composer install
on 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
.
这篇关于更新时作曲家被杀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:更新时作曲家被杀
基础教程推荐
- mysqli_insert_id 是否有可能在高流量应用程序中返回 2021-01-01
- 如何在 PHP 中的请求之间持久化对象 2022-01-01
- 通过 PHP SoapClient 请求发送原始 XML 2021-01-01
- WooCommerce 中选定产品类别的自定义产品价格后缀 2021-01-01
- Libpuzzle 索引数百万张图片? 2022-01-01
- 在 Woocommerce 中根据运输方式和付款方式添加费用 2021-01-01
- XAMPP 服务器不加载 CSS 文件 2022-01-01
- 超薄框架REST服务两次获得输出 2022-01-01
- 在多维数组中查找最大值 2021-01-01
- 在 PHP 中强制下载文件 - 在 Joomla 框架内 2022-01-01