Skip to content

env: Unable to boot on Windows OS #50814

@t-hamano

Description

@t-hamano

Description

It appears that version 7.0.0 of the env package is no longer able to start on Windows OS.

Here are all the logs after running the command:

Log
npm run wp-env start

> test@ wp-env D:\Desktop\test
> wp-env "start"

‼ Warning: could not find a .wp-env.json configuration file and could not determine if 'D:\Desktop\test' is a WordPress installation, a plugin, or a theme.
× Error while running docker-compose command.
#1 [internal] load build definition from WordPress.Dockerfile
#1 transferring dockerfile: 1.91kB 0.0s done
#1 DONE 0.1s

#2 [internal] load .dockerignore
#2 transferring context: 2B 0.0s done
#2 DONE 0.1s

#3 [internal] load metadata for docker.io/library/wordpress:latest
#3 DONE 2.5s

#4 [ 1/17] FROM docker.io/library/wordpress@sha256:f3b8d54fe9b80e88255121a46933ca1961fb9f3f39e6981a668cdb7f019a5bbd
#4 DONE 0.0s

#5 [ 9/17] RUN apt-get -qy install sudo
#5 CACHED

#6 [11/17] RUN echo 'upload_max_filesize = 1G' >> /usr/local/etc/php/php.ini
#6 CACHED

#7 [ 6/17] RUN useradd -m -u 0 -g 0 {username} || true
#7 CACHED

#8 [ 7/17] RUN apt-get -qy update
#8 CACHED

#9 [ 2/17] RUN sed -i 's|deb.debian.org/debian stretch|archive.debian.org/debian stretch|g' /etc/apt/sources.list
#9 CACHED

#10 [ 8/17] RUN apt-get -qy install autoconf            dpkg-dev                file            g++             gcc             libc-dev                make            pkg-config              re2c && touch /usr/local/etc/php/php.ini
#10 CACHED

#11 [ 5/17] RUN groupadd -g 0 {username} || true
#11 CACHED

#12 [ 3/17] RUN sed -i 's|security.debian.org/debian-security stretch|archive.debian.org/debian-security stretch|g' /etc/apt/sources.list
#12 CACHED

#13 [15/17] RUN php /tmp/composer-setup.php --install-dir=/usr/local/bin --filename=composer
#13 CACHED

#14 [12/17] RUN echo 'post_max_size = 1G' >> /usr/local/etc/php/php.ini
#14 CACHED

#15 [13/17] RUN curl -sS https://getcomposer.org/installer -o /tmp/composer-setup.php
#15 CACHED

#16 [14/17] 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;"
#16 CACHED

#17 [10/17] RUN echo "{username} ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
#17 CACHED

#18 [ 4/17] RUN sed -i '/stretch-updates/d' /etc/apt/sources.list
#18 CACHED

#19 [16/17] RUN rm /tmp/composer-setup.php
#19 CACHED

#20 [17/17] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#20 ERROR: process "/bin/sh -c composer global require --dev yoast/phpunit-polyfills:\"^1.0\"" did not complete successfully: unable to find user {username}: no matching entries in passwd file  
------
 > [17/17] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0":
------
failed to solve: process "/bin/sh -c composer global require --dev yoast/phpunit-polyfills:\"^1.0\"" did not complete successfully: unable to find user {username}: no matching entries in passwd file
npm ERR! code ELIFECYCLE
npm ERR! errno 17
npm ERR! test@ wp-env: `wp-env "start"`
npm ERR! Exit status 17
npm ERR!
npm ERR! Failed at the test@ wp-env script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\{username}\AppData\Roaming\npm-cache\_logs\2023-05-20T13_27_15_180Z-debug.log

I deleted all Docker containers, images, volumes, and networks before running the command. With env version 6.0.0, it can be started normally.

The following are possible error locations in the logs:

#20 [17/17] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0"
#20 ERROR: process "/bin/sh -c composer global require --dev yoast/phpunit-polyfills:\"^1.0\"" did not complete successfully: unable to find user {username}: no matching entries in passwd file  
------
 > [17/17] RUN composer global require --dev yoast/phpunit-polyfills:"^1.0":
------
failed to solve: process "/bin/sh -c composer global require --dev yoast/PHPUnit-polyfills:\"^1.0\"" did not complete successfully: unable to find user {username}: no matching entries in passwd file

{username} shows the actual Windows OS login user. If the following commands are executed directly, the installation completed successfully:

composer global require --dev yoast/phpunit-polyfills:"^1.0"

I think this issue might be related to #50408, where the command causing the error was added.

Step-by-step reproduction instructions

  • Create a package.json like the following:
{
  "name": "test",
  "scripts": {
    "wp-env": "wp-env"
  },
  "dependencies": {
    "@wordpress/env": "^7.0.0"
  }
}
  • npm i
  • npm run wp-env start

Screenshots, screen recording, code snippet

No response

Environment info

No response

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

Metadata

Metadata

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions