Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested packages would not be found in local repositories #9145

Closed
Kolyunya opened this issue Aug 24, 2020 · 1 comment
Closed

Nested packages would not be found in local repositories #9145

Kolyunya opened this issue Aug 24, 2020 · 1 comment

Comments

@Kolyunya
Copy link

Kolyunya commented Aug 24, 2020

The problem

My composer.jsons for three projects located in adjacent (all next to each other) local directories are:

{
    "name": "acme/foo",
    "require": {
    },
    "repositories": [
        {
            "type": "path",
            "url": "../*"
        }
    ]
}
{
    "name": "acme/bar",
    "require": {
        "acme/foo": "dev-master"
    },
    "repositories": [
        {
            "type": "path",
            "url": "../*"
        }
    ]
}
{
    "name": "acme/baz",
    "require": {
        "acme/bar": "dev-master"
    },
    "repositories": [
        {
            "type": "path",
            "url": "../*"
        }
    ]
}

Output of composer diagnose:

Checking composer.json: WARNING
No license specified, it is recommended to do so. For closed-source software you may use "proprietary" as license.
require.acme/bar : unbound version constraints (dev-master) should be avoided
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: OK
Checking https connectivity to packagist: OK
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: FAIL
Missing pubkey for tags verification
Missing pubkey for dev verification
Run composer self-update --update-keys to set them up
Checking composer version: OK
Composer version: 1.10.10
PHP version: 7.4.9
PHP binary path: /usr/bin/php
OpenSSL version: OpenSSL 1.1.1g  21 Apr 2020

When I run this command:

cd foo
composer update
# OK

cd ../bar
composer update
# OK

cd ../baz
composer update
# NOT OK :(

I get the following output:

Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for acme/bar dev-master -> satisfiable by acme/bar[dev-master].
    - acme/bar dev-master requires acme/foo dev-master -> 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.
 - It's a private package and you forgot to add a custom repository to find it

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

And I expected this to happen: acme/foo is found in the ../* repository.

Failed attempts to fix the problem

Things I've tried:

  • Defining a separate repository for each package.
  • Using absolute repository paths.
  • Disabling symlinks.

None of these worked.

Workarounds

I was able to find one workaround which I find a bit dirty. It turns out that if you require both acme/foo and acme/bar then the dependencies would resolve normally.

Important observations

  • When first installing via symlinks and then disabling them, composer update would not mirror the package. It will remain symlinked. This may be considered as a separate issue.
@Seldaek
Copy link
Member

Seldaek commented Oct 17, 2020

Seems like a case of https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-recursively.md

@Seldaek Seldaek closed this as completed Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants