Where and how to clean the vendor folder?

"If something is corrupt in your composer and you do composer install/update it won't fix it. You have to force reinstall that package. Try cleaning the vendor folder and run composer install or composer update"


The vendor folder is inside your working directory:

enter image description here

You can remove it with command line:

rm -rf vendor/*

After that run composer:

composer update

If "composer update" doesn't work, then may want to try execute Install after rm command. Like this:

rm -rf vendor/*

After than run composer:

composer install

That will install/download the vendor directory content.

If your composer command not finished but killed, then can try to increase the memory_limit in the php.ini file. So will allow it use more memory for the composer process.

Can check the current memory_limit from your SSH console:

php -i | grep memory

Hope that would help to someone.


I wrote a short shell script that does the job for me. It checks if you are in the correct directory, where the composer.json is inside.


if [ ! -f "./composer.json" ]
    echo "File ./composer.json does not exists"
    exit 1

if [ ! -d "./vendor" ]
    echo "Directory ./vendor does not exists"

# First call without --quiet to get the output of what exactly was changed
composer install "$@";

rm -rf ./vendor;

# Second call after deleting vendor folder to reinstall everything but with --quiet to not push out the previous output
composer install "$@" --quiet;

It works also with parameters, e.g.:

composer-reinstall -vvv

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.