duangu4943 2018-10-22 21:56
浏览 229
已采纳

运行composer update时出现内存错误

Error:

Updating vlucas/phpdotenv (v2.4.0 => v2.5.1): The following exception is caused by a lack of memory or swap, or not having swap configured Check https://getcomposer.org/doc/articles/troubleshooting.md#proc-open-fork-failed-errors for details

Currently the AWS Instance RAM: 2GB

Though we have fixed the issue by upgrading RAM from 2GB => 4GB but I have few doubts as increasing RAM this should not be the solution for a small site.

Could you please check the following points:

1) What is the recommended memory required by Laravel for updating the packages (composar.phar update)?

2) Does laravel use SWAP memory as well while composer update?

  • 写回答

2条回答 默认 最新

  • dougekui1518 2018-10-22 22:11
    关注

    I had the same problem and never found the reason. You could run composer update --profile or even composer update --profile -vvv to have a detailed list of what's going on under the hood. The first one will show you how much memory is used.

    It shouldn't be over 600Mb. But still you will run out of memory. As the laravel app goes into maintenance mode, it shouldn't add to it. You could run in a second shell the command top -ac and see what happens there.

    The hosting company couldn't help me either as they blamed it on me lol.

    But there is a way around. Upload the composer.lock only and on the production server run composer install --no-dev. It will give you a warning about outdated packages. Answer 'yes' and your prod server will be updated without a glitch. This command runs the laravel composer.json scripts commands too and updates the composer.json package versions..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)
编辑
预览

报告相同问题?

手机看
程序员都在用的中文IT技术交流社区

程序员都在用的中文IT技术交流社区

专业的中文 IT 技术社区,与千万技术人共成长

专业的中文 IT 技术社区,与千万技术人共成长

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

关注【CSDN】视频号,行业资讯、技术分享精彩不断,直播好礼送不停!

客服 返回
顶部