Composer doesn’t allow me to install the latest update of the module. Is there a solution for it?

Composer doesn’t allow me to install the latest update of the module. Is there a solution for it?

There are two possible reasons why the composer is not fetching the latest version of the module. The first one is that the module package is loaded from caches - composer cannot see the latest available version, so it loads the latest that is available in the cache:



A simple workaround for this is to specify the exact version you need to be installed:  

composer require amasty/module-name:^x.x.x

Still, the composer might throw another error, stating that the required version doesn’t match your minimum stability or that your requirements couldn’t be resolved to an installable set of packages:



The issue occurs because the package version you’re trying to install requires an update of other dependent packages. An easy fix is to update the dependent packages to the latest available or latest required version, in our case this is amasty/base that needs to be updated to version 1.12.

Another solution to it is to require the main package (amasty/module-elastic-search) and specify that it should be updated together with all dependencies:

composer require amasty/module-name:^x.x.x --update-with-dependencies