Composer killed while updating

✔ Recommended Answer

The "Killed" message usually means your process consumed too much memory, so you may simply need to add more memory to your system if possible. At the time of writing this answer, I've had to increase my virtual machine's memory to at least 768MB in order to get composer update to work in some situations.

However, if you're doing this on a live server, you shouldn't be using composer update at all. What you should instead do is:

  1. Run composer update in a local environment (such as directly on your physical laptop/desktop, or a docker container/VM running on your laptop/desktop) where memory limitations shouldn't be as severe.
  2. Upload or git push the composer.lock file.
  3. Run composer install on the live server.

composer install will then read from the .lock file, fetching the exact same versions every time rather than finding the latest versions of every package. This makes your app less likely to break, and composer uses less memory.

Read more here:

Alternatively, you can upload the entire vendor directory to the server, bypassing the need to run composer install at all, but then you should run composer dump-autoload --optimize.


Answered By: Andreas

Method #2

If Composer is killed while updating, it may leave your project in an inconsistent state. To fix this, you can try the following steps:

  1. Check for any lock files: Before attempting to run Composer again, check for any lock files that may have been left behind. These files are typically named composer.lock or composer.phar.lock. If you find any lock files, delete them before continuing.

  2. Clear Composer cache: Clear the Composer cache by running the following command:

    composer clear-cache

    This will delete any cached packages and metadata that may be causing issues.

  3. Update Composer: Update Composer to the latest version by running the following command:

    composer self-update

    This will ensure that you're running the latest stable version of Composer.

  4. Run Composer update: Finally, run the Composer update command again to update your dependencies:

    composer update

    This will download and install the latest versions of your project's dependencies, as specified in your composer.json file.

If you continue to have issues with Composer, you may need to investigate further to determine the root cause of the problem. Some possible causes of issues with Composer include a lack of disk space, network connectivity issues, or conflicts between dependencies.


Most Popular

Remove Unicode Zero Width Space PHP

PhpStorm, return value is expected to be 'A', 'object' returned

Laravel file upload returns forbidden 403, file permission is 700 not 755