Could not find a version of package matching your minimum-stability. Require it with an explicit version constraint allowing its desired stability
Asked Answered
F

2

6

I've created a package (innovareti/password-policy) and now I am trying to install it, but it is not found:

$ composer require innovareti/password-policy
...
  [InvalidArgumentException]                              
  Could not find a version of package innovareti/password-policy
  matching your minimum-stability (dev). Require it with an explicit
  version constraint allowing its desired stability.

(this error keeps ocurring)

It does have a tag and a release, and I've updated it in packagist but it's still not working, even after the update on packagist is done already for a couple of minutes and I can see it there fine.

This is the composer.json of the package:

{
  "name": "innovareti/password-policy",
  "description": "A library to intuitively create password policies and validate a subject against them.",
  "autoload": {
    "psr-4": {
      "PasswordPolicy\\Tests\\": "tests/",
      "PasswordPolicy\\": "src/PasswordPolicy/",
      "PasswordPolicy\\Database\\Factories\\": "database/factories",
      "PasswordPolicy\\Models\\": "src/Models"
    }
  },
  "extra":{
    "laravel": [
      "src/PasswordPolicy/Providers/Laravel/PasswordPolicyServiceProvider"
    ]
  },
  "require": {
    "php": "^5.5"
  },
  "scripts": {
    "test": "vendor/bin/phpunit",
    "test-f": "vendor/bin/phpunit --filter"
  },
  "minimum-stability": "dev"
}

My repository is at: https://github.com/innovareti/password-policy

I've tried many things I saw online but nothing worked, can anyone help me?

Ferriferous answered 2/12, 2022 at 1:40 Comment(2)
It would still be great after you've found the answer yourself, to add your initial composer version to the question (please edit), so that it becomes more complete and would allow future users with a similar question to find whether its applicable to them or not (so they won't need to try as many things as you had to).Burning
Also I edited both your question (a bit) and answer (a bit more). Please check if everything is correct from your perspective and if the references are indeed helpful from your point of view.Burning
F
1

Apparently the problem was that new packages published to packagist need to be installed with composer on version 21.

I ran composer selfupdate --2 to update my version of composer which was 1.x.

Then required my package by running composer require innovareti/password-policy and it worked.


  1. Compare "Restricted access to unused packages via the v1 metadata API starting in May 2021" in Deprecating Packagist.org support for Composer 1.x ( Jordi Boggiano for packagist.org; Feb 2021)

Further References

Ferriferous answered 2/12, 2022 at 2:2 Comment(0)
D
0

It's actually because your package is missing a version. Once you add that it will work.

Dufy answered 11/9, 2024 at 12:1 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.