Description
I’ve noticed that as of late, @wordpress/env requires an internet connection to run a local copy of the Gutenberg repo; otherwise, npm run wp-env start will abort with an error message (see below).
This is unfortunate, as it prevents working on Gutenberg while offline (e.g. on a plane etc).
The problem is due to getLatestWordPressVersion, which includes a call to the https://api.wordpress.org/core/stable-check/1.0/ endpoint. Ideally, we find a fallback to make wp-env work even without an internet connection.
getLatestWordPressVersion was introduced in #43133. AFAICT, the rationale behind it was to default to the current WordPress version in case there was none specified in .wp-env.json.
This makes sense; however, it'd be great if we could avoid the side effect of wp-env not working altogether when offline.
My vague idea about getting this to work offline would be to check if the local ~/.wp-env cache directory contains any Docker images that match the config in .wp-env.json -- IIRC, we create some kind of hash based on the latter that we use to look up the corresponding ~/.wp-env subdirectory. Curious to hear your thoughts if that would be feasible @noahtallen
#52157 is probably due to the same underlying problem, but since it's specifically about wp-env install-path, I thought it'd make sense to file a separate issue. cc/ @swissspidy @t-hamano
Step-by-step reproduction instructions
- Disable your Internet connection.
- Run
npm run wp-env start.
- You'll see the following error:
✖ getaddrinfo ENOTFOUND api.wordpress.org
RequestError: getaddrinfo ENOTFOUND [api.wordpress.org](http://api.wordpress.org/)
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
Description
I’ve noticed that as of late,
@wordpress/envrequires an internet connection to run a local copy of the Gutenberg repo; otherwise,npm run wp-env startwill abort with an error message (see below).This is unfortunate, as it prevents working on Gutenberg while offline (e.g. on a plane etc).
The problem is due to
getLatestWordPressVersion, which includes a call to the https://api.wordpress.org/core/stable-check/1.0/ endpoint. Ideally, we find a fallback to makewp-envwork even without an internet connection.getLatestWordPressVersionwas introduced in #43133. AFAICT, the rationale behind it was to default to the current WordPress version in case there was none specified in.wp-env.json.This makes sense; however, it'd be great if we could avoid the side effect of
wp-envnot working altogether when offline.My vague idea about getting this to work offline would be to check if the local
~/.wp-envcache directory contains any Docker images that match the config in.wp-env.json-- IIRC, we create some kind of hash based on the latter that we use to look up the corresponding~/.wp-envsubdirectory. Curious to hear your thoughts if that would be feasible @noahtallen#52157 is probably due to the same underlying problem, but since it's specifically about
wp-env install-path, I thought it'd make sense to file a separate issue. cc/ @swissspidy @t-hamanoStep-by-step reproduction instructions
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