laravel 作曲家更新问题

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

Composer update trouble

laravelcomposer-php

提问by Fede

I'm using laravel + composer . I'm loading way/generators package and when I run composer update give me this error:

我正在使用 laravel + composer 。我正在加载 way/generators 包,当我运行 composer update 时给我这个错误:

Loading composer repositories with package information Updating dependencies (including require-dev)

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 170

使用包信息加载 Composer 存储库 更新依赖项(包括 require-dev)

致命错误:在 phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/Solver 中允许的内存大小为 536870912 字节(试图分配 67108864 字节)第 170 行的 .php

回答by Y M

I think, This is because composer update has used all the memory.

我认为,这是因为 composer update 已经使用了所有内存。

php -d memory_limit=1G /usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar update

This works for me on a mac.

这在 mac 上对我有用。

Also check out to use composer install.

还要检查使用 composer install 。

回答by Sajjad Ashraf

If you are on a server with less amount of RAM like 512MB you will need to create swap memory. Here is how you do it on ubuntu

如果您使用的是 RAM 较少的服务器,例如 512MB,您将需要创建交换内存。这是您在 ubuntu 上的操作方法

touch swap.img
chmod 600 swap.img

Using 1GB for swap

使用 1GB 进行交换

dd if=/dev/zero of=/var/swap.img bs=1024k count=1000
mkswap /var/swap.img
swapon /var/swap.img

Here is the full article https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps

这是完整的文章https://www.digitalocean.com/community/tutorials/how-to-configure-virtual-memory-swap-file-on-a-vps

回答by Xing L

I was having problem to install laravel with composer. Original command was:

我在用作曲家安装 Laravel 时遇到问题。原来的命令是:

composer global require "laravel/installer=~1.1"

And Error message was:

错误信息是:

Loading composer repositories with package information Updating dependencies (including require-dev)

Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 67108864 bytes) in phar:///usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar/src/Composer/DependencyResolver/Solver.php on line 170

Following command should work:

以下命令应该有效:

php -dmemory_limit=1G /usr/local/Cellar/composer/1.0.0-alpha8/libexec/composer.phar global require "laravel/installer=~1.1"

回答by d.danailov

I found solution, after read this post: https://github.com/composer/composer/issues/1898

我找到了解决方案,阅读这篇文章后:https: //github.com/composer/composer/issues/1898

Thank you to "Dynom, commented on Jul 4, 2013"

感谢“Dynom,于 2013 年 7 月 4 日发表评论”

Needing 512MiB RAM for a package-manager is already a bit much, but I also exceed it. The interesting part is that I exceed 512 MiB RAM (up to around 800 MiB RAM according to my process output) when I use my private Satis repository (which is actually just a cache for all Github public repositories). I do not exceed it otherwise. Just by adding my satis repository, composer consumes almost 400 MiB more RAM

To all the others raising their PHP CLI memory_limit globally, I recommend against that. Instead I suggest to put it in the command line, like so:

包管理器需要 512MiB RAM 已经有点多了,但我也超过了它。有趣的是,当我使用我的私有 Satis 存储库(它实际上只是所有 Github 公共存储库的缓存)时,我超过了 512 MiB RAM(根据我的进程输出高达大约 800 MiB RAM)。否则我不会超过它。仅通过添加我的 satis 存储库,composer 就消耗了近 400 MiB 的 RAM

对于在全球范围内提高 PHP CLI memory_limit 的所有其他人,我建议不要这样做。相反,我建议将它放在命令行中,如下所示:

php -dmemory_limit=1G {composer location} update 

Example:

例子:

php -dmemory_limit=1G bin/composer.phar update

Otherwise you could potentially miss certain unintended memory related behaviour in your own work.

否则,您可能会在自己的工作中错过某些与记忆相关的意外行为。

Tested on: Debian version 6

测试:Debian 版本 6

回答by db80

Do you have the last version of composer? I've fixed that problem with a simple update:

你有最新版本的作曲家吗?我通过一个简单的更新解决了这个问题:

sudo composer self-update

回答by Charles

In my case I encountered the same problem and manage to solve by halting the Apache and MySQL service and then proceeding to install the laravel application via composer.

就我而言,我遇到了同样的问题,并通过停止 Apache 和 MySQL 服务,然后通过 composer 继续安装 Laravel 应用程序来设法解决。

The sudo service stop apache2followed by sudo service stop mysql stopthis in turn killed the application that were consuming memory I then proceeded to install the Laravel via the normal composer command once done I just restarted the service and everything was fine.

sudo service stop apache2随后sudo service stop mysql stop这又杀了那个被占用的内存我接着做一次我只是重新启动该服务一切都还顺利通过正常的作曲家命令安装Laravel应用。