Composer - Requested Package [0.0.9] 作为 [0.0.5,0.0.6] 存在,但这些被您的约束拒绝

2022-01-21 00:00:00 git php composer-php

今天我在 composer 更新中遇到了一个我无法描述自己的奇怪错误.

<代码>{存储库":{我的插件":{类型":vcs","url": "git@mycodebase.com:mjplug/myplugin.git"}},要求": {我的插件/我的插件":0.0.9",}}

当我尝试 composer update 然后我会得到

请求的包 my-plugin/my-plugin 0.0.9 以 my-plugin/my-plugin[0.0.6, 0.0.5] 的形式存在,但这些被您的约束拒绝.

但存储库中存在 0.0.7, 0.0.8, 0.0.9 等标签.为什么没有被发现?

如果我将 ~0.0.1 设置为版本约束,它会起作用,因为 composer 将安装 0.0.6.

有什么提示吗?谢谢

这是我们的 Bitbucket 服务器实例的屏幕截图:http://imgur.com/a/m8lRT

编辑 2:已解决: 在最近的某个版本中,我出于某种原因将 composer.json 放到了一个子目录中.所以这就是composer找不到最新标签的问题.

解决方案

因为Wordpress Plugin Files需要在子文件夹中,所以我把包括composer.json在内的所有文件都放到了子目录下,并推送了新版本.

后来我尝试在我的项目中安装新版本,但没有找到新版本.这就是问题所在.composer.json 需要在根目录下.(愚蠢的我)

有用的命令:composer show myplugin/myplugin

Today I got a strange error within a composer updatewhich I can't describe myself.

{
   "repositories": {
       "my-plugin": {
           "type": "vcs",
           "url": "git@mycodebase.com:mjplug/myplugin.git"
       }
    },
   "require": {
        "my-plugin/myplugin": "0.0.9",
   }    
}

When I try composer update then I'll get

The requested package my-plugin/my-plugin 0.0.9 exists as my-plugin/my-plugin[0.0.6, 0.0.5] but these are rejected by your constraint.

But there exists tags like 0.0.7, 0.0.8, 0.0.9 in the repository. Why aren't they found?

If I set ~0.0.1 as version constraint it works because composer will install 0.0.6.

Any hints? Thank you

EDIT: Here is a Screenshot of our Bitbucket Server Instance: http://imgur.com/a/m8lRT

EDIT 2: SOLVED: In some last release I put the composer.json for some reason to a sub-directory. So this was the problem that composer couldn't find the latest tags.

解决方案

Because Wordpress Plugin Files need to be in a subfolder I put all files including composer.json to a subdirectory and pushed a new version.

Later I tried to install the new version inside my project and the new version(s) weren't found. This was the issue. The composer.json needs to be in root. (Stupid me)

Useful Command: composer show myplugin/myplugin

相关文章