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
Unable to Create "web" Directory for Drupal Projects in Docker with Composer 2.7.0 #11853 #11854
Comments
Could it be that the directory was created by a plugin and that this plugin is not executed with 2.7.0 as you run Composer as the root user (see #11839)? |
It's likely related, but I've already attempted using "export COMPOSER_ALLOW_SUPERUSER=1" without success. I'm working with Drupal, and this is what I have noticed:
The issue appears confined to Docker environments; outside of Docker, the process works flawlessly. |
Have you tried prefixing the composer command with |
I spent the entire morning trying to figure out why this was happening, and finally came across this thread. I assume therefore that we would need to add the plugins we wish to execute ( without using COMPOSER_ALLOW_SUPERUSER=1 ) to the config.allow-plugins list? |
I'm commenting the same thing on this as I've commented on #11839 I spent the entire morning debugging why at first, the web folder was not created by Drupal project scaffolding from my Docker image. Fatal error: Uncaught Error: Class "Drupal" not found in /var/www/html/vendor/drush/drush/src/Boot/DrupalBoot8.php:93 After reverting COMPOSER_ALLOW_SUPERUSER=1 and applying the composer self-update 2.6.6 solution, things restarted working as intended. This indicates to me that there's more to the solution than just setting COMPOSER_ALLOW_SUPERUSER |
@Arr-n-D I'm not sure what the issue is there, but I know for sure that rolling back to 2.6.6 is not a long term solution. It's just hiding the problem and gets you stuck on an unmaintained Composer release. I'm fairly sure that either running as non-root or setting the COMPOSER_ALLOW_SUPERUSER=1 env var should get 2.7.0 running more or less like 2.6.6 did. So if there is another issue still maybe it's a small regression somewhere else. That's worth investigating IMO but I have no drupal knowledge and no working docker setup so I'd be happy if someone affected can help figure some of this out. |
I can confirm that COMPOSER_ALLOW_SUPERUSER=1 only mitigated the problem where the Web folder wasn't created, but additional issues rose further down the line. Running as non-root is in the works for our workflow, but it's not something I can do in the short-term without adding a bunch of things to my workload. I think it'd be worth investigating indeed, but I myself don't have much knowledge with Drupal in terms of project configuration, I am but the DevOps 😄 I could potentially try to generate a starter project with Drupal that fails due to this exact issue and send it over to you |
@Arr-n-D This was the correct solution for me : Probesys/bileto@777ee4c |
This seems to require running things with a non-root user. As mentioned, it is not currently viable for me to change that |
@Arr-n-D You are right, I was able to install "web" folder successfully but now I am having problems with drush not existing. |
Could it be that drush or whatever plugin is running when drupal installs runs composer again in a subprocess that does not have the COMPOSER_ALLOW_SUPERUSER env var set, thus causing some failures? Do you have instructions for me so I can try to repro this? Just composer commands to run and a git repo to clone if needed. |
@Seldaek Once I get off work today, I'll try and wip up a reproduceable example for you |
…ing as non-interactive root, mainly create-project, refs #11854
From @daniela-zc 's message:
That is interesting, it allowed me to catch one last place where we didn't disable plugins correctly in create-project. c3efff9 fixes that so both install and create-project should fail in the same way now when run as root without COMPOSER_ALLOW_SUPERUSER=1 set. I was able to reproduce that the web dir is created when having the env var, I see this after the composer install is complete:
And without I do not get this, and indeed the web dir does not exist. Note the lines with yellow and red background in this output: So I am still waiting to see a way to repro the failure with the env var set correctly. As far as I can tell it all works as it should. |
Issue Report:
When attempting to install Drupal into a Docker container using Composer version 2.7.0, the expected "web" directory is missing, causing issues with project setup. This behavior is unexpected and disrupts the standard Drupal installation process within Docker environments.
Temporal solution:
Downgrade to Composer 2.6.6: As a temporary workaround, reverting to Composer version 2.6.6 has been observed to resolve the issue. This allows for the creation of the "web" directory as expected, enabling the Drupal project setup within Docker containers.
The text was updated successfully, but these errors were encountered: