D
D
d-virt2016-10-01 16:01:49
Composer
d-virt, 2016-10-01 16:01:49

How to deal with "no matching package found." (assuming the package actually exists)?

Hello!
During the development of a package ( пакет_№_1), it may be necessary to include another package ( пакет_№_2) in a section require( PS NOT IN require-dev ). APPI use it in the application and пакет_№_1I know that the dependent one will automatically be pulled пакет_№_2into my application. But, unfortunately, this does not happen ( that is, when the package is installed, its dependencies are not pulled up ), for the reason described below:
PS I use windows. All packages are located locally on disk.
PSS folder hierarchy:

../test.loc
..../laravel  (тут лежит приложение)
..../packages (тут лежат мои пакеты)
....../catalog (пакет каталога)
....../category (пакет категории)

composer.json - APP applications
{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.6.4",
        "laravel/framework": "5.3.*",
        "test/catalog": "1.0.0" // прошу заметить, что тут я указываю конкретную версию
    },
    "require-dev": {
        "fzaninotto/faker": "~1.4",
        "mockery/mockery": "0.9.*",
        "phpunit/phpunit": "~5.0",
        "symfony/css-selector": "3.1.*",
        "symfony/dom-crawler": "3.1.*",
        "barryvdh/laravel-ide-helper": "v2.2.1"
    },
    "repositories": [
        {"type": "git", "url": "C:\\web\\www\\test.loc\\packages\\test\\catalog"}
    ],
// .... я специально тут обрезал, т.к. далее идет запуск доп. скриптов и определение PSR4
}

composer.json - пакет_№_1(catalog)
{
    "name": "test/catalog",
    "authors": [
        {
            "name": "test",
            "email": "[email protected]"
        }
    ],
    "require": {
        "php": ">=5.6.4",
        "test/category": "1.0.0"
    },
    "repositories": [
        {"type": "git", "url": "C:\\web\\www\\test.loc\\packages\\test\\category"}
    ],
    "autoload": {
        "psr-4": {
            "Test\\Catalog\\": "src/"
        }
    },
    "minimum-stability": "dev",
    "extra": {
        "branch-alias": {
            "dev-master": "master"
        }
    }
}

composer.json - пакет_№_2(category)
{
    "name": "test/category",
    "authors": [
        {
            "name": "test",
            "email": "[email protected]"
        }
    ],
    "require": {
    "php": ">=5.6.4"
  },
    "autoload": {
        "psr-4": {
            "Test\\Category\\": "src/"
        }
    },
    "minimum-stability": "dev",
    "extra": {
        "branch-alias": {
            "dev-master": "master"
        }
    }
}

If we go to пакет_№_1(catalog) and execute the command composer update, then пакет_№_2(category) will automatically be pulled into the vendor folder ( as if everything works correctly here ).
If we go into the application APPand execute the command composer update, it gives an error:
Loading composer repositories with package information
Reading composer.json of test/catalog (1.0.0)
Reading composer.json of test/catalog (@dev)
Reading composer.json of test/catalog (master)
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for test/catalog 1.0.0 -> satisfiable by test/catalog[1.0.0].
    - test/catalog 1.0.0 requires test/category 1.0.0 -> 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://getcomposer.org/doc/04-schema.md#minimum-stability> for more details.

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

I tried to do:
composer clear-cache- it did not help.
composer prohibits test/catalog 1.0.0- gives an error ( Could not find package "test/catalog" in your project )
Of course, the repositories contain all the tags and the actual composer.json:
test.loc/packages/catalog# git tag
1.0.0
test.loc/packages/category# git tag
1.0.0

Question: Please clarify what I'm doing wrong? Why not pull up dependent пакет_№_2(catalog) in APP ?
Thank you!
The funny thing is that if APPwe specify in the composer.json application:
"repositories": [
        {"type": "git", "url": "C:\\web\\www\\test.loc\\packages\\test\\catalog"},
        {"type": "git", "url": "C:\\web\\www\\test.loc\\packages\\test\\category"}
    ],

then everything works and the packets are pulled up. But it makes sense to duplicate the link to the package when this link is already in the package being pulled.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SilverSlice, 2016-10-03
@d-virt

Make stable releases. Wrote more here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question