Kevin Regenrek
Kevin Regenrek

Reputation: 842

Composer - Requested Package [0.0.9] exists as [0.0.5,0.0.6] but these are rejected by your constraint

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

{
   "repositories": {
       "my-plugin": {
           "type": "vcs",
           "url": "[email protected]: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: https://i.sstatic.net/EnsOw.jpg

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.

Upvotes: 16

Views: 2686

Answers (3)

Kevin Regenrek
Kevin Regenrek

Reputation: 842

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

Upvotes: 1

yergo
yergo

Reputation: 4980

As of described on Composer documentation i would update your tags to: v0.0.7, v0.0.8, v0.0.9 on your master branch. Thus should help composer follow what is said:

Composer first asks the VCS to list all available tags, then creates an internal list of available versions based on these tags. In the above example, composer's internal list includes versions 1.0, 1.0.1, 1.0.2, the beta release of 1.1, the first and second release candidates of 1.1, the final release version 1.1, etc.... (Note that Composer automatically removes the 'v' prefix in the actual tagname to get a valid final version number.

Once those tags on your master, your "my-plugin/myplugin": "0.0.9" or "my-plugin/myplugin": "0.0.*" etc should work properly.

Upvotes: 3

user3677687
user3677687

Reputation:

Composer allows using branches as versions by specifying them as dev-, so dev-master relates to master branch. If you want to specify a specific tag, it goes like

"author/package": "dev-master#v1.1.0"

Also see the link:

LINK

Reference

Upvotes: 3

Related Questions