Composer: no matching package found

4.1k views Asked by At

I create a widget that is under development. The problem is that when I run:

composer require chofoteddy/yii2-bootstrap-wizard "*"

I get the following message:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for chofoteddy/yii2-bootstrap-wizard * -> satisfiable by chofoteddy/yii2-bootstrap-wizard[dev-master].
    - chofoteddy/yii2-bootstrap-wizard dev-master requires vinceg/twitter-bootstrap-wizard * -> no matching package found.

Potential causes:
 - A typo in the package name
 - The package is not available in a stable-enough version according to your minimum-stability setting
   see <https://groups.google.com/d/topic/composer-dev/_g3ASeIFlrc/discussion> for more details.

Read <https://getcomposer.org/doc/articles/troubleshooting.md> for further common problems.

Installation failed, reverting ./composer.json to its original content.

What I seek is to add https://github.com/VinceG/twitter-bootstrap-wizard.git repository as a dependency of my project. "VinceG/twitter-bootstrap-wizard" is not registered in "Packagist".

I modified many times my composer.json file, in order to correct it, but I can not make it work.

My file composer.json:

{
    "name": "chofoteddy/yii2-bootstrap-wizard",
    "description": "Wizard form based on twitter bootstrap plugin (@VinceG)",
    "homepage": "https://github.com/Chofoteddy/yii2-bootstrap-wizard",
    "keywords": [
        "yii2",
        "wizard",
        "bootstrap",
        "yii2-extension"
    ],
    "type": "yii2-extension",
    "version": "0.1",
    "license": "MIT",
    "authors": [
        {
            "name": "Christopher",
            "email": "[email protected]"
        }
    ],
    "minimum-stability": "dev",
    "require": {
        "php": ">=5.4.0",
        "VinceG/twitter-bootstrap-wizard": "*"
    },
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/VinceG/twitter-bootstrap-wizard"
        }
    ],
    "autoload": {
        "psr-4": {
            "chofoteddy\\wizard\\": ""
        }
    }
}

Composer information:

sudo composer self-update
You are already using composer version b2173d28fc8b56236eddc8aa10dcda61471633ec.
2

There are 2 answers

0
Pᴇʜ On

Because VinceG/twitter-bootstrap-wizard is not a Composer package (it does not include a composer.json) you have to define this in your composer.json

Your repository section should look like this:

"repositories": [
    {
        "type": "package",
        "package": {
            "name": "VinceG/twitter-bootstrap-wizard",
            "version": "1.2",
            "dist": {
                "url": "https://github.com/VinceG/twitter-bootstrap-wizard/archive/1.2.zip",
                "type": "zip"
            },
            "source": {
                "url": "https://github.com/VinceG/twitter-bootstrap-wizard.git",
                "type": "git",
                "reference": "1.2"
            }
        }
    }
],

You might also have a look at component-installer and the composer-asset-plugin to manage components and bower packages within composer.

0
tsdogs On

The problem is probably the minimum-stability defined in your project root composer.json (or if not defined it defaults to stable)

As the bower repository has no release yet you should:

  1. "VinceG/twitter-bootstrap-wizard": "@dev"
  2. define minimum-stability: "@dev"

Please note that if you use this package from a different project you need to either define minimum-stability: "@dev" in that project or define the "VinceG/twitter-bootstrap-wizard": "@dev" in root composer.json

There's also an option in composer which lets you specify: "prefer-stable"

More info on this: https://igor.io/2013/02/07/composer-stability-flags.html