-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Env: Issues with composer global require
#51419
Comments
Hi @weltmx, Thanks for the report. I'm a Windows user and have confirmed that I can successfully launch it with the latest version (8.1.0) of env. If anyone is willing to test this on MacOS, please comment on the test results. |
Hi @weltmx, Tested on Mac 13.4. Both wp-env 7 and 8 launched.
Is it possibly the version number of "Docker Desktop"? If so, it is an older version and updating to the latest version may help. |
I had some issues (not sure they were the same ones) and updating the docker desktop version helped. I was only a number of minor versions behind. |
@weltmx What happens if run |
Same issue here on macOS with M1 Pro, wp-env 8.2.0, Docker Desktop 4.20.1 (current latest), Docker engine 24.0.2. Unfortunately Interestingly Composer gets installed correctly, but running the command after that still breaks.
|
I am experiencing this issue as well with wp-env 8.2.0, Docker Desktop 4.21.1, and Docker Engine 24.0.2. This did not occur on my Windows 11 instance. |
This is my output from that command (below) and I forgot to mention I'm on a M1 Mac. ✖ Error while running docker-compose command.
#1 [wordpress internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [wordpress internal] load build definition from WordPress.Dockerfile
#2 transferring dockerfile: 1.97kB done
#2 DONE 0.0s
#3 [wordpress internal] load metadata for docker.io/library/wordpress:php8.1
#3 DONE 0.0s
#4 [wordpress 1/19] FROM docker.io/library/wordpress:php8.1
#4 DONE 0.0s
#5 [wordpress 15/19] RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
#5 CACHED
#6 [wordpress 4/19] RUN sed -i 's|security.debian.org/debian-security stretch|archive.debian.org/debian-security stretch|g' /etc/apt/sources.list
#6 CACHED
#7 [wordpress 11/19] RUN apt-get -qy install sudo
#7 CACHED
#8 [wordpress 9/19] RUN apt-get -qy install autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c && touch /usr/local/etc/php/php.ini
#8 CACHED
#9 [wordpress 13/19] RUN echo 'upload_max_filesize = 1G' >> /usr/local/etc/php/php.ini
#9 CACHED
#10 [wordpress 7/19] RUN useradd -mlo -u 1642390085 -g 20 z-watkins || true
#10 CACHED
#11 [wordpress 14/19] RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini
#11 CACHED
#12 [wordpress 2/19] RUN touch /etc/apt/sources.list
#12 CACHED
#13 [wordpress 5/19] RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
#13 CACHED
#14 [wordpress 12/19] RUN echo "#1642390085 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#14 CACHED
#15 [wordpress 3/19] RUN sed -i 's|deb.debian.org/debian stretch|archive.debian.org/debian stretch|g' /etc/apt/sources.list
#15 CACHED
#16 [wordpress 17/19] RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
#16 CACHED
#17 [wordpress 8/19] RUN apt-get -qy update
#17 CACHED
#18 [wordpress 18/19] RUN rm /tmp/composer-setup.php
#18 CACHED
#19 [wordpress 6/19] RUN groupadd -o -g 20 z-watkins || true
#19 CACHED
#20 [wordpress 10/19] RUN apt-get -qy install git
#20 CACHED
#21 [wordpress 16/19] RUN export COMPOSER_HASH=`curl -sS https://composer.github.io/installer.sig` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$COMPOSER_HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;"
#21 CACHED
#22 [wordpress 19/19] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#22 CACHED
#23 [wordpress] exporting to image
#23 exporting layers done
#23 writing image sha256:b8f43500846e2776cd5b183ca69aa5ca47e4b4d79a89487ee9051af35bc1b4a3 done
#23 naming to docker.io/library/b0862e38e2d51cc075328697c5cdca95-wordpress done
#23 DONE 0.0s
#24 [tests-wordpress internal] load .dockerignore
#24 transferring context: 2B done
#24 DONE 0.0s
#25 [tests-wordpress internal] load build definition from Tests-WordPress.Dockerfile
#25 transferring dockerfile: 1.98kB 0.0s done
#25 DONE 0.0s
#3 [tests-wordpress internal] load metadata for docker.io/library/wordpress:php8.1
#3 DONE 0.0s
#4 [tests-wordpress 1/19] FROM docker.io/library/wordpress:php8.1
#4 DONE 0.0s
#6 [tests-wordpress 4/19] RUN sed -i 's|security.debian.org/debian-security stretch|archive.debian.org/debian-security stretch|g' /etc/apt/sources.list
#6 CACHED
#8 [tests-wordpress 9/19] RUN apt-get -qy install autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c && touch /usr/local/etc/php/php.ini
#8 CACHED
#14 [tests-wordpress 12/19] RUN echo "#1642390085 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#14 CACHED
#10 [tests-wordpress 7/19] RUN useradd -mlo -u 1642390085 -g 20 z-watkins || true
#10 CACHED
#9 [tests-wordpress 13/19] RUN echo 'upload_max_filesize = 1G' >> /usr/local/etc/php/php.ini
#9 CACHED
#16 [tests-wordpress 17/19] RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
#16 CACHED
#7 [tests-wordpress 11/19] RUN apt-get -qy install sudo
#7 CACHED
#21 [tests-wordpress 16/19] RUN export COMPOSER_HASH=`curl -sS https://composer.github.io/installer.sig` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$COMPOSER_HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;"
#21 CACHED
#17 [tests-wordpress 8/19] RUN apt-get -qy update
#17 CACHED
#20 [tests-wordpress 10/19] RUN apt-get -qy install git
#20 CACHED
#13 [tests-wordpress 5/19] RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
#13 CACHED
#18 [tests-wordpress 18/19] RUN rm /tmp/composer-setup.php
#18 CACHED
#19 [tests-wordpress 6/19] RUN groupadd -o -g 20 z-watkins || true
#19 CACHED
#12 [tests-wordpress 2/19] RUN touch /etc/apt/sources.list
#12 CACHED
#15 [tests-wordpress 3/19] RUN sed -i 's|deb.debian.org/debian stretch|archive.debian.org/debian stretch|g' /etc/apt/sources.list
#15 CACHED
#11 [tests-wordpress 14/19] RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini
#11 CACHED
#5 [tests-wordpress 15/19] RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
#5 CACHED
#22 [tests-wordpress 19/19] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#22 CACHED
#26 [tests-wordpress] exporting to image
#26 exporting layers done
#26 writing image sha256:7ad05a215c30208d97d5c366d258f8a4fcffb3916952634208e64ff0a2a817c4 done
#26 naming to docker.io/library/b0862e38e2d51cc075328697c5cdca95-tests-wordpress done
#26 DONE 0.0s
#27 [cli internal] load .dockerignore
#27 transferring context: 2B done
#27 DONE 0.0s
#28 [cli internal] load build definition from CLI.Dockerfile
#28 transferring dockerfile: 1.80kB done
#28 DONE 0.0s
#29 [cli internal] load metadata for docker.io/library/wordpress:cli-php8.1
#29 DONE 0.0s
#30 [cli 1/14] FROM docker.io/library/wordpress:cli-php8.1
#30 DONE 0.0s
#31 [cli 3/14] RUN adduser -h /home/z-watkins -G $( getent group 20 | cut -d: -f1 ) -u 1642390085 z-watkins || true
#31 CACHED
#32 [cli 4/14] RUN apk update
#32 CACHED
#33 [cli 12/14] RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
#33 CACHED
#34 [cli 6/14] RUN apk --no-cache add sudo linux-headers
#34 CACHED
#35 [cli 11/14] RUN export COMPOSER_HASH=`curl -sS https://composer.github.io/installer.sig` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$COMPOSER_HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;"
#35 CACHED
#36 [cli 10/14] RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
#36 CACHED
#37 [cli 8/14] RUN echo 'upload_max_filesize = 1G' >> /usr/local/etc/php/php.ini
#37 CACHED
#38 [cli 7/14] RUN echo "#1642390085 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#38 CACHED
#39 [cli 5/14] RUN apk --no-cache add autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c && touch /usr/local/etc/php/php.ini
#39 CACHED
#40 [cli 2/14] RUN addgroup -g 20 z-watkins || true
#40 CACHED
#41 [cli 9/14] RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini
#41 CACHED
#42 [cli 13/14] RUN rm /tmp/composer-setup.php
#42 CACHED
#43 [cli 14/14] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#43 ...
#30 [tests-cli 1/14] FROM docker.io/library/wordpress:cli-php8.1
#30 DONE 0.0s
#33 [tests-cli 12/14] RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
#33 CACHED
#40 [tests-cli 2/14] RUN addgroup -g 20 z-watkins || true
#40 CACHED
#37 [tests-cli 8/14] RUN echo 'upload_max_filesize = 1G' >> /usr/local/etc/php/php.ini
#37 CACHED
#36 [tests-cli 10/14] RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
#36 CACHED
#39 [tests-cli 5/14] RUN apk --no-cache add autoconf dpkg-dev dpkg file g++ gcc libc-dev make pkgconf re2c && touch /usr/local/etc/php/php.ini
#39 CACHED
#38 [tests-cli 7/14] RUN echo "#1642390085 ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#38 CACHED
#32 [tests-cli 4/14] RUN apk update
#32 CACHED
#34 [tests-cli 6/14] RUN apk --no-cache add sudo linux-headers
#34 CACHED
#31 [tests-cli 3/14] RUN adduser -h /home/z-watkins -G $( getent group 20 | cut -d: -f1 ) -u 1642390085 z-watkins || true
#31 CACHED
#35 [tests-cli 11/14] RUN export COMPOSER_HASH=`curl -sS https://composer.github.io/installer.sig` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$COMPOSER_HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;"
#35 CACHED
#41 [tests-cli 9/14] RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini
#41 CACHED
#42 [tests-cli 13/14] RUN rm /tmp/composer-setup.php
#42 CACHED
#44 [tests-cli internal] load .dockerignore
#44 transferring context: 2B done
#44 DONE 0.0s
#45 [tests-cli internal] load build definition from Tests-CLI.Dockerfile
#45 transferring dockerfile: 1.81kB 0.0s done
#45 DONE 0.0s
#29 [tests-cli internal] load metadata for docker.io/library/wordpress:cli-php8.1
#29 DONE 0.0s
#43 [tests-cli 14/14] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#43 0.569
#43 0.573 In Filesystem.php line 254:
#43 0.573
#43 0.574 /.composer does not exist and could not be created.
#43 0.574
#43 0.574
#43 0.575 global <command-name> [<args>...]
#43 0.575
#43 ERROR: process "/bin/sh -c composer global require --dev yoast/phpunit-polyfills:\"^1.0\"" did not complete successfully: exit code: 1
------
> [tests-cli 14/14] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0":
0.569
0.573 In Filesystem.php line 254:
0.573
0.574 /.composer does not exist and could not be created.
0.574
0.574
0.575 global <command-name> [<args>...]
0.575
------
failed to solve: process "/bin/sh -c composer global require --dev yoast/phpunit-polyfills:\"^1.0\"" did not complete successfully: exit code: 1 |
Update: my co-worker was able to install it on an identical M1 Macbook laptop and I think the problem comes down to the environment variable value for Edit: On hers, inside the container, it is On mine, inside the container, it is If I create the directory by modifying the Docker image generator in #23 [wordpress 18/20] RUN sudo mkdir /home/user-name/.composer/
#23 DONE 0.1s
#24 [tests-wordpress 19/20] RUN rm /tmp/composer-setup.php
#24 DONE 0.1s
#25 [wordpress 20/20] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#25 0.193 Changed current directory to /home/user-name/.composer
#25 0.198
#25 0.201 In RequireCommand.php line 142:
#25 0.201
#25 0.201 file_put_contents(./composer.json): Failed to open stream: Permission denie
#25 0.201 d |
I just posted an edit to my comment above with additional differences between our environments. |
I was able to get diff --git a/packages/env/lib/init-config.js b/packages/env/lib/init-config.js
--- a/packages/env/lib/init-config.js
+++ b/packages/env/lib/init-config.js
@@ -241,6 +241,9 @@ RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini`;
dockerFileContent += `
RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
RUN export COMPOSER_HASH=\`curl -sS https://composer.github.io/installer.sig\` && php -r "if (hash_file('SHA384', '/tmp/composer-setup.php') === '$COMPOSER_HASH') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('/tmp/composer-setup.php'); } echo PHP_EOL;"
+ENV HOME=/home/$HOST_USERNAME
+RUN mkdir -p /home/$HOST_USERNAME/.composer/
+RUN chown -R $HOST_UID:$HOST_GID /home/$HOST_USERNAME/.composer/
RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
RUN rm /tmp/composer-setup.php`; |
I'm hitting this same issue, but with a slightly different error, and only when using the
|
Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks. |
There's been a bunch of additional info added to this since the |
composer global require
This changes actually fix the issue which is still present when you enable |
I ran into this issue today too and your workaround helped. A note that I wasn't sure where to find my global init-config.js file so I used |
Is this only an issue on M1 Mac? Has anyone else had this issue on a machine other than an M1 Mac? |
I'm experiencing this issue on Intel i7. I was able to get it running on 6.0.0: Uninstall: Install older version: Clean up and re-run |
I had the same problem on M3 Macbook laptop, I could solve it by making edits on the
And then I had a free space error message:
That was because I had many orphan volumes on my container I solved it with the following: Clean up and re-run |
Description
Hey,
wp-env start
worked on6.0.0
just fine, but not on7.0.0
and latest.Maybe caused by whatever changed in: #50814
System:
Docker 3.5.2 (3.5.2.18)
macOS 13.0
Step-by-step reproduction instructions
wp-env start
worked on6.0.0
just fine:but not on
7.0.0
and latestScreenshots, screen recording, code snippet
No response
Environment info
Docker 3.5.2 (3.5.2.18)
macOS 13.0
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: