Composer killed while updating

后端 未结 16 1799
野性不改
野性不改 2020-11-28 19:40

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          


        
相关标签:
16条回答
  • 2020-11-28 19:40

    Run composer self-update and composer clearcache remove vendor and composer.lock restart your local environment and then run php -d memory_limit=-1 /usr/local/bin/composer install

    0 讨论(0)
  • 2020-11-28 19:40

    You can try setting preferred-install to "dist" in Composer config.

    0 讨论(0)
  • 2020-11-28 19:41

    If like me, you are using some micro VM lacking of memory, creating a swap file does the trick:

    #Check free memory before
    free -m
    
    mkdir -p /var/_swap_
    cd /var/_swap_
    #Here, 1M * 2000 ~= 2GB of swap memory.  Feel free to add MORE
    dd if=/dev/zero of=swapfile bs=1M count=2000
    mkswap swapfile
    swapon swapfile
    chmod 600 swapfile
    #Automatically mount this swap partition at startup
    echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
    
    #Check free memory after
    free -m
    

    As several comments pointed out, don't forget to add sudo if you don't work as root.

    btw, feel free to select another location/filename/size for the file.
    /var is probably not the best place, but I don't know which place would be, and rarely care since tiny servers are mostly used for testing purposes.

    0 讨论(0)
  • 2020-11-28 19:41

    If you're using docker you can use COMPOSER_PROCESS_TIMEOUT

    environment:
      COMPOSER_MEMORY_LIMIT: -1
      COMPOSER_PROCESS_TIMEOUT: 2000 #seconds
    
    0 讨论(0)
  • 2020-11-28 19:43

    Here's how I succeeded in installing maatwebsite\excel package from composer in Laravel Framework:

    1. I download composer.json file and composer.lock file from my remote server.
    2. I run composer update from local command prompt (then wait until all the install process finished).
    3. Upload composer.lock file to remote server.
    4. run composer install on remote server (then wait until all process finished).
    5. DONE
    0 讨论(0)
  • 2020-11-28 19:45

    I get this problem caused for a package that don't update correctly with wildcards, I use directly the last version and it works finally.

    "l3/cas-bundle": "~1.0" -------> "l3/cas-bundle": "1.1.13"

    0 讨论(0)
提交回复
热议问题