Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#55914 closed defect (bug) (duplicate)

npm install still does not work on wordpress-trunk on new Mac M1's (Unknown MySQL server host 'mysql')

Reported by: sandrasanzdev's profile sandrasanzdev Owned by:
Milestone: Priority: normal
Severity: normal Version: 6.1
Component: Build/Test Tools Keywords: needs-patch
Focuses: Cc:

Description

This is a follow-up to #52356.

When running npm run env:install I get this error, and need to manually change the mysql image to amd64/mariadb in the docker-compose.yml file to get it to work. I know this happened at least to another person with an M1 besides me on WCEUs contributor day.

> WordPress@6.1.0 env:install
> node ./tools/local-env/scripts/install.js

Creating network "wordpress-develop_wpdevnet" with driver "bridge"
Creating wordpress-develop_cli_run ... done
ERROR 2005 (HY000): Unknown MySQL server host 'mysql' (-2)
ERROR: 1
node:child_process:902
    throw err;
    ^

Error: Command failed: docker-compose run --rm cli config create --dbname=wordpress_develop --dbuser=root --dbpass=password --dbhost=mysql --path=/var/www/src --force
    at checkExecSyncError (node:child_process:828:11)
    at execSync (node:child_process:899:15)
    at wp_cli (/Users/sandra/Projects/WCEU/ContributorDay/wordpress-develop/tools/local-env/scripts/install.js:52:2)
    at Object.<anonymous> (/Users/sandra/Projects/WCEU/ContributorDay/wordpress-develop/tools/local-env/scripts/install.js:14:1)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 3097,
  stdout: null,
  stderr: null
}

It's weird because it seems that this was a known issue that was already patched, and the fix seemed to work for some people.

Change History (5)

#1 @SergeyBiryukov
3 years ago

  • Milestone changed from Awaiting Review to 6.1

#2 @afragen
3 years ago

When the npm commands are all chained as in
npm install && npm run build:dev && npm run env:start && npm run env:install

It seems that MySQL hasn't quite started before the npm run env:install starts, giving this error.

The solution is to only chain the first 3 commands and then run the install.

npm install && npm run build:dev && npm run env:start
npm run env:install

#3 @johnbillion
3 years ago

  • Milestone 6.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Thanks for the report! This is a duplicate of #50342.

#4 @sandrasanzdev
3 years ago

Sorry to insist but is this exactly the same issue as #55914 though?

  • @afragen I didn't chain any commands, executed all of them separately. But chaining only the first three and executing npm run env:install separately throws this same error.
  • npm run env:start throws the same error as npm run env:install, so it's not an issue with waiting for mysql to be available.
  • Throwing the commands again doesn't solve the issue.
  • Only happens on M1 Macs.
  • Changing the mysql container to amd64/mariadb fixes the issue.

My problem seems unrelated to the availability of the mysql container and more related to the fact that the image the container is using is not compatible with M1, as discussed in the last posts in #52356.

Version 0, edited 3 years ago by sandrasanzdev (next)

#5 @afragen
3 years ago

@sandrasanzdev the fix we are referring to is r53358.

Note: See TracTickets for help on using tickets.