How to solve this error on live server for laravel?

前端 未结 2 1849
名媛妹妹
名媛妹妹 2021-01-02 07:21

I have installed this package success locally composer require spatie/laravel-image-optimizer, but when I tried to install on the live server I got this errors<

2条回答
  •  天命终不由人
    2021-01-02 07:56

    Your problem is related to the probable fact of having only 1gb of RAM and not having memory swap, so let's create and enable it to take some time off at the time of composer execution.

    Folow this steps:

    1) Creating 1gb memory swapfile:

    $ sudo fallocate -l 1G /swapfile
    
    $ sudo dd if=/dev/zero of=/swapfile bs=1024 count=1048576
    

    This command created the /swapfile file with 1GB in size.

    2) Configuring file to swap:

    $ sudo chmod 600 /swapfile
    
    $ sudo mkswap /swapfile
    

    3) Enable swap:

    $ sudo swapon /swapfile
    

    To see result you can run free -m or see on htop

    Example: $ sudo free -m

                  total       usada       livre    compart.  buff/cache  disponível
    Mem.:          7664        1052        3436          56        3175        6259
    Swap:          1024           0        1024
    

    Example: $ sudo swapon --show

    NAME      TYPE SIZE USED PRIO
    /swapfile file   1G   0B   -2
    

    Test please.

提交回复
热议问题