I’m trying to install the module via composer, but the package is not found. How to resolve it?

I’m trying to install the module via composer, but the package is not found. How to resolve it?

Composer is the dependency manager that allows you easily download the required files on your server. The files are located on a remote server, or a repository, that you need to add to the list of “known” ones and authenticate to using the username and password. During the process of installation, the composer checks all the available repositories and finds the package with the specified name. In case the package doesn’t belong to any of the known repositories or there is no such a package in the known repositories, composer throws the following error:

[InvalidArgumentException] Could not find a matching version of package amasty/color-swatches-pro. Check the package spelling, your version constraint and that the package is available in a stability which matches your minimum-stability (alpha)

What you can do to resolve this:
      
1. Check if the repository you’re trying to reach is listed in composer.json file, under ‘repositories’ section:



2. To make sure you are trying to reach the correct repository, you may run the following command: composer show -a amasty/* . It will show all available modules from Amasty. If the repository has been added correctly, the extension in question will be displayed in the list: 



3. Make sure that you’re requesting the module using the same account that was used for the purchase. The username and password that you use for the authentication to composer repository should coincide with the public and private keys in your customer account in the Products tab:


      
4. Flush composer caches with command composer clearcache