Elavarasan
Elavarasan

Reputation: 2669

Git - Could not find a matching version of package in magento

I'm trying to install a module from github using composer, but every time I'm getting same error,

[InvalidArgumentException]
  Could not find a matching version of package Worldpay/Worldpay-Magento2-CG.
   Check the package spelling, your version constraint and that the package i
  s available in a stability which matches your minimum-stability (dev).

Below is my part of composer.json,

 "minimum-stability": "dev",
    "repositories": {
        "0": {
            "type": "composer",
            "url": "https://repo.magento.com/"
        },
        "Worldpay-Worldpay-Magento2-CG": {
            "type": "git",
            "url": "https://github.com/Worldpay/Worldpay-Magento2-CG.git"
        }
    },

Below are the command list I have tried,

composer require Worldpay/Worldpay-Magento2-CG dev-master
composer require Worldpay/Worldpay-Magento2-CG:~2.0
composer require Worldpay/Worldpay-Magento2-CG @master
composer require Worldpay/Worldpay-Magento2-CG @dev-master
composer require Worldpay/Worldpay-Magento2-CG "^2.0"
composer require Worldpay/Worldpay-Magento2-CG:dev/master

(small letter)

composer require worldpay/worldpay-magento2-cg:dev-master

I have tried with ssh link also in composer.json. And with out "minimum-stability": "dev", part.

The current latest version of this module is 2.0. And the stable branch is Master. I have tried to get directly that version and the branch with above commands. But every time I'm getting same error message.

And additionally latest version (2.0) of that module is not listed in packagist

https://packagist.org/packages/sapient/module-worldpay

In packagist the latest version is showing as 1.5.3. After that I have done 4 releases. But it is not available in packagist. Should I submit manually ?.

So seems like somewhere I did mistake. Should I create Stable (branch name) branch in github ?. Any advise will be really great.

Upvotes: 6

Views: 16859

Answers (2)

Greko2015 GuFn
Greko2015 GuFn

Reputation: 589

These 2 things worked for me

I needed to add the repository reference to my composer.json because it wasn't there

"repositories": [
         {
             "type": "composer",
            "url": "https://repo.magento.com/"
        }
    ],

I needed to rename my auth.json.sample to auth.json and add the public and private keys to the json.


{
    "http-basic": {
        "repo.magento.com": {
            "username": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "password": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
        }
    }
 }

If you want to input your private and public keys manually then do not include the auth.json

image lien As shown here https://magento.stackexchange.com/questions/243524/could-not-find-a-matching-version-of-package-magento-product-community-edition/293614#293614

Upvotes: 6

rob006
rob006

Reputation: 22174

For composer require command you should use package name defined in composer.json, URL of repository is irrelevant. So it should be something like:

composer require sapient/module-worldpay:dev-master

And additionally latest version (2.0) of that module is not listed in packagist

You should probably configure GitHub hooks to inform Packagist about repo updates, see https://packagist.org/about#how-to-update-packages

Upvotes: 9

Related Questions