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
Composer 2.2+ breaks composer create-project <template> or composer install when no composer.lock file is present under some specific circunstances. #10469
Comments
To me, what happened is that |
Yeah, but the requirement is no set like that. Also, when a project is being generated there's no git repo at all |
Without seeing the composer.json of the template package, I cannot really help you. But from looking at the output, the error does not happen during the initial creation of the project from the template, but when resolving the dependencies defined in that template (i.e. when doing the equivalent of running a You can confirm that by adding the |
And the requirement in https://github.com/pantheon-upstreams/drupal-recommended/blob/main/composer.json#L17 is using Relying on |
@stof thanks for replying. I confirm that the problem is when it's resolving dependencies. I ran create-project with --no-install and it works as expected and then it fails when I run
Should create-project run git init? It's not doing it and I just tested with another template published in packagist and it doesn't initiate git. Actually that's the part that puzzles me the most: there's no git repository, how is it supposed to find a dev-main or dev-master branch? |
hmm, indeed. In that case, the running a |
@stof thanks again for following-up. Now I understand the problem a bit better: it turns out that the "self.version" in the template is changed to the branch that gets used on the create-project command. So, if it's creating the project from master, it becomes dev-master and then the problem pops up. As far as I understand (please correct me if I'm wrong), that's the expected behavior with self.version under these circumstances and a good solution for my case would be either:
If this is considered expected behavior and my proposed solution for my use case makes sense, then I think we can close this issue. Once again, thank you very much for all of your help and for the great work with composer :) |
To me, this is indeed the expected behavior. In the master branch, |
Great, thanks! |
My
composer.json
: https://github.com/pantheon-upstreams/drupal-recommended/blob/master/composer.jsonOutput of
composer diagnose
:When I run this command:
I get the following output:
And I expected this to happen:
Project creation to work; however it failed in a similar way than #10431 so I'm guessing it's somehow related?
Also, if in the generated project I enter and run
composer install
while there is no composer.lock I get the same errorThe text was updated successfully, but these errors were encountered: