Closed joachim-n closed 11 months ago
Well, technically, this gives you another view of the problem: this error indicates that the root package itself has a requirement forbidding to use this version (which was already there in the other output as drupal/recommended-project - requires drupal/core-recommended (^9.5)
but might have been missed)
and the case where your own composer.json forbids it is the only case where the other command will fail early instead of running the solver.
It crashes with an [InvalidArgumentException], and without -vvv that's all you see.
the root package itself has a requirement forbidding to use this version (which was already there in the other output as drupal/recommended-project - requires drupal/core-recommended (^9.5)
I don't understand how else I'm supposed to upgrade that package? There is currently a root requirement for ^9.5 and I want to now upgrade to ^10.1. How else should I do this?
Well, if you want to update it to 10.1, you need to update your composer.json to change the requirement.
That's not my point with this issue.
Composer outputs a message that says 'Try command composer foo
. But doing composer foo
crashes. Composer should not give bad advice to the user.
IMHO a bit borderline to call it bad advice to try a --dry-run command, but nevertheless I like @fredden's proposal in https://github.com/composer/composer/pull/11691 as the require gives a different view on the problem and is exception free in this case. I tried reproducing and could, but require does not lead to an installable set in my testbed (no idea if this was considered an installable set in the first place as the report is about the suggestion message, not the dependencies.)
@joachim-n can you try with the patches from #11691 / #11692 and share how it looks from your end?
IMHO a bit borderline to call it bad advice to try a --dry-run command
I think you're still missing my point. It is bad advice to recommend a specific command which will crash.
@joachim-n : Nah, just my opinion. Please apply those specific patches mentioned and report back if they specifically address your point from your point of view and any more commentary you have about those. This would allow me to better help you finding a solution for your issue.
Ok with latest snapshot the why-not command now outputs:
Not finding what you were looking for? Try calling
composer require "drupal/core-recommended:^10.1" --dry-run
to get another view on the problem.
So I'll call this fixed. Thanks everyone
My
composer.json
:Output of
composer diagnose
:When I run this command:
I get the following output:
But then this command, as instructed:
produces this output:
And I expected this to happen:
Composer should not tell me to run a command that it then tells me it can't run.