duangu4943 2018-10-23 05:56
浏览 228

运行composer update时出现内存错误


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-23 06: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..

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
  • donglan6777 2018-10-23 06:06

    Ideally, composer update is only run on your development environment, when you push your code in AWS server, the command you must use is composer install (which doesn't use too much memory).

    If you want to know the difference between update or install, refer to this link: What are the differences between composer update and composer install?




  • ¥15 实验 4 FIFO 算法和 LRU 算法-C 程序实现
  • ¥30 电脑画面同步投屏,通过同wifi的方式投屏方法,接收投屏端不需要安装第三方软件,
  • ¥15 有偿拼接大疆精灵4RGB影像
  • ¥15 MATLAB特殊符号
  • ¥15 Arduino实现音频混响
  • ¥15 cuda.jit加速报错
  • ¥15 Octave 安装工具箱出错 Only Win32 target is supported!
  • ¥15 docker save的不能在另一台设备运行
  • ¥15 Unity Animation Rigging使用问题
  • ¥15 mbedtls握手返回-7200