Git - 在 magento 中找不到匹配的包版本

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

我正在尝试使用 composer 从 github 安装一个模块,但每次我都遇到同样的错误,

[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).

下面是我的部分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"
        }
    },

下面是我试过的命令列表,

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

(小写字母)

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

我也在 composer.json 中尝试过使用 ssh link。并且没有 "minimum-stability": "dev", 部分。

该模块当前最新版本为2.0.,稳定分支为Master。我试图用上面的命令直接获取那个版本和分支。但每次我收到相同的错误消息。

此外,该模块的最新版本 (2.0) 未在 packagist

中列出

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

packagist 中,最新版本显示为 1.5.3。之后我做了 4 次发布。但它在 packagist 中不可用。我应该手动提交吗?

看来我在某个地方弄错了。我应该在 github 中创建稳定(分支名称)分支吗?任何建议都会很棒。

对于composer require命令,您应该使用composer.json中定义的包名称,与存储库的URL无关。所以它应该是这样的:

composer require sapient/module-worldpay:dev-master

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

您可能应该配置 GitHub 挂钩以通知 Packagist 有关回购更新,请参阅 https://packagist.org/about#how-to-update-packages

这两件事对我有用

我需要添加对我的 composer.json 的存储库引用,因为它不存在

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

我需要将 auth.json.sample 重命名为 auth.json,并将 public 和私钥添加到 json。


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

如果您想手动输入私钥和 public 密钥,请不要输入 auth.json

image lien 如图所示https://magento.stackexchange.com/questions/243524/could-not-find-a-matching-version-of-package-magento-product-community-edition/293614#293614