Reputation: 2647
How can I force composer to re-install completely all my vendor packages?
I lost most of my JS files inside the vendor folders while syncing with the server. It happens. What I noticed is that there's no command to force composer to RE-install completely a package. What it does, is that it checks if the version is the latest uploaded and if it is it skip that package. Also deleting the lock file won't work.
Any way to solve this?
Upvotes: 4
Views: 1977
Reputation: 1358
Not realizing that composer would not completely update a directory without it being deleted first, Saldaek's answer was just what I needed, with the following caveats.
On Magento 2, the directory can only be deleted after the call to bin/magento maintenance:enable
, as the bin/magento
command depends upon the packages being deployed. So the package vendor
directory is deleted just before the call to composer update
.
Here is my current order:
cd html
# required to remove object definition conflicts (self-deprecating bad code smell)
rm -rfv app/code/<vendor package>
bin/magento maintenance:enable
rm -rfv vendor/<vendor package>
composer update
# required a second time as the update will run autoload
rm -rfv app/code/<vendor package>
bin/magento cache:flush
bin/magento cache:clean
composer dump-autoload
rm -rfv generated/code var/di
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy en_US
bin/magento indexer:reindex
bin/magento maintenance:disable
cd ..
Upvotes: 0
Reputation: 42036
If you delete the vendor directory of the package, then it will be reinstalled on the next install or update. For example if the package is called foo/bar
, deleting vendor/foo/bar
will do the trick. If it's a plugin to some CMS or something it might be in another location than vendor though, if you have a recent composer (run composer self-update
to make sure) you can check where it is located by running composer show -iP
, the output should list all packages and their install path.
Upvotes: 5