Composer hanging while updating dependencies

前端 未结 13 1255
青春惊慌失措
青春惊慌失措 2020-12-24 05:30

I tried updating a Laravel project I\'m working on today using composer update

But it hung on Updating dependencies (including require-dev)

相关标签:
13条回答
  • 2020-12-24 06:00

    check the path of [xdebug] zend_extension = "file/path" in php.ini

    0 讨论(0)
  • 2020-12-24 06:06

    So it turns out the problem was with php's xdebug extension. After disabling it in my php.ini, composer ran without any problems.

    And just to note, the hang-up wasn't actually occurring while reading files from the cache. It was the step right after where composer was trying to resolve dependencies. It just never finished that step and never printed the output. That's why no matter what I did, it always appeared to be stuck reading a file from the cache.

    0 讨论(0)
  • 2020-12-24 06:06

    this worked for me:

    composer self-update
    
    0 讨论(0)
  • 2020-12-24 06:10

    1st of all : Check firewall and proxy connections. If everything is ok but composer is still hanging try to clear composer cache:

    composer clear-cache
    

    https://getcomposer.org/doc/03-cli.md#clear-cache

    2nd option If these steps does not repair your composer then it's possible that the system does not have enough RAM memory available (I faced this problem and the symptomps were the same that you describe). At this point you have two options:

    a) Increase memory (Virtual Machines or Docker) : Your container or VM needs more available memory. Follow this guide: https://stackoverflow.com/a/44533437/3518053

    b) Generate swap file (Linux) : Try creating a swap file to provide more memory: (Above commands are from composer killed while updating)

    free -m
    mkdir -p /var/_swap_
    cd /var/_swap_
    #Here, 1M * 2000 ~= 2GB of swap memory
    dd if=/dev/zero of=swapfile bs=1M count=2000
    mkswap swapfile
    swapon swapfile
    chmod 600 swapfile
    echo "/var/_swap_/swapfile none swap sw 0 0" >> /etc/fstab
    #cat /proc/meminfo
    free -m
    
    0 讨论(0)
  • 2020-12-24 06:10

    For me the issue was with xDebug. I was using IDE's terminal, and the debugger was listening to incoming connections (as always). Turning the listening off (without requiring to disable the extension) solved the issue.

    0 讨论(0)
  • 2020-12-24 06:12

    Some times it is stuck because it is trying to use HTTP instead of https so just run this

    composer config --global repo.packagist composer https://packagist.org
    
    0 讨论(0)
提交回复
热议问题