Why I can't use composer require {packageName}

2019-08-30 08:36发布

问题:

I'm learn how to create Laravel packages, And I wrote a package here: noahprot/fillindata

Then I submit it to packagist

And I have set a lastest release in github

And the Packagist show like this: Already show the latest release

Then I use Laravel CLI Tool create a new laravel project, I want try to use this package, and I use composer require noahprot/fillindata

But the result like this:

  [InvalidArgumentException]                                                                                                              
  Could not find a version of package noahprot/fillindata matching your 
  minimum-stability (dev). Require it with an explicit version con  
  straint allowing its desired stability.  

my package's composer.json file like this:

{
"name": "noahprot/fillindata",
"License": "MIT",
"description": "take the csv file fill into database table",
"authors": [
    {
        "name": "Noah Prot",
        "email": "mylovewangjian@gmail.com"
    }
],
"autoload": {
    "psr-4": {
        "NeoLee\\Fillindata\\": "src/"
    }
},
"extra": {
    "laravel": {
        "providers": [
            "NoahProt\\Fillindata\\FillindataServiceProvider"
        ]
    }
},
"require": {}

}

I make some try like: add "minimum-stability": "dev" to composer.json, but failed, even I edit to "stable", but failed too;

I have no idea for this situation now;

Guys, Please Help me, and give some advice, please!

Thank you everyone!

回答1:

It seems that Packagist have some cache-related problems, see this issue. Mirror you're using probably have some outdated packages info. At this point you can do only two things:

  1. Wait until packages data on mirror will be refreshed.
  2. Report your case (see this comment).