【问题标题】:Git - Could not find a matching version of package in magentoGit - 在 magento 中找不到匹配版本的包
【发布时间】:2019-10-02 12:30:53
【问题描述】:

我正在尝试使用 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 链接。并且没有"minimum-stability": "dev", 部分。

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

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

中列出

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

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

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

【问题讨论】:

    标签: git composer-php magento2


    【解决方案1】:

    这两件事对我有用

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

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

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

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

    如果你想手动输入你的私钥和公钥,那么不要包含 auth.json

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

    【讨论】:

      【解决方案2】:

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

      composer require sapient/module-worldpay:dev-master
      

      另外,该模块的最新版本 (2.0) 未在 packagegist 中列出

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2021-04-03
        • 1970-01-01
        • 2017-08-16
        • 2019-09-18
        • 2019-11-07
        • 1970-01-01
        • 2017-11-03
        • 2021-08-04
        相关资源
        最近更新 更多