composer-link icon indicating copy to clipboard operation
composer-link copied to clipboard

Linked transitive dependancy

Open TLG-Gildas opened this issue 10 months ago • 2 comments

I have a problem resolving transitive dependency.

I have the following projects with their dependencies:

  • libA
  • libB
    • -> libA:^XA.YA
  • prj
    • -> libB:^XB.YB

I am trying to link libA into prj, but I then encounter the following problem when I run composer link /path/to/libA:

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

  Problem 1
    - Root composer.json requires libA == dev-linked, found libA[dev-linked] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - libB is locked to version XB.YB.ZB and an update of this package was not requested.
    - libB XB.YB.ZB requires libA ^XA.YA -> satisfiable by libA[XA1.YA1.ZA1, ..., XAN.YAN.ZAN] from composer repo but libA[dev-linked] from array repo (defining 1 package) has higher repository priority. The packages from the higher priority repository do not match your constraint and are therefore not installable. That repository is canonical so the lower priority repo's packages are not installable. See https://getcomposer.org/repoprio for details and assistance.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Even if I mark libB with minimal stability @dev, it doesn't solve the problem.

TLG-Gildas avatar Feb 05 '25 15:02 TLG-Gildas

Hey,

Thanks for reporting the issue, I have time to dive into this bug this weekend 😉

One workaround (I think it should work) is to also link libB but without dependencies.

composer link /path/to/libB --without-dependencies
composer link /path/to/libA

Another workaround is downgrading to version 0.4.1, that version doesn't handle dependencies at all and just symlinks the library.

SanderSander avatar Feb 06 '25 14:02 SanderSander

Thanks for your reply and your time.

Unfortunatly, I had already tried he first workaround and I tried again in doubt, but it does not work. We get the same error.

The second workaround should actually work.

TLG-Gildas avatar Feb 06 '25 15:02 TLG-Gildas

Any update to this issue? I have same problem.

I did downgrade to 0.41 and it works good. But would be nice to have a future proof solution in this wonderful package.

cyppe avatar Apr 14 '25 20:04 cyppe

So I think https://github.com/SanderSander/composer-link/discussions/80 would be the solution for this issue.

I tried to fix this issue in way over complicated ways, I'm going to try the solution as described in the linked discussion.

SanderSander avatar Apr 17 '25 12:04 SanderSander