Skip to content
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

Local Environment: Failure to start in Gutenberg directory #405

Closed
adamziel opened this issue May 22, 2023 · 5 comments · Fixed by #410
Closed

Local Environment: Failure to start in Gutenberg directory #405

adamziel opened this issue May 22, 2023 · 5 comments · Fixed by #410
Assignees
Labels
[Type] Bug An existing feature does not function as intended

Comments

@adamziel
Copy link
Collaborator

Description

This is the error I'm getting. I'm not sure how to act on it:

$ wp-now start
mode: plugin
php: 8.0
wp: WordPress/WordPress
Error: Unrecognized WordPress version. Please use "latest" or numeric versions such as "6.2", "6.0.1", "6.2-beta1", or "6.2-RC1"
    at getWordPressVersionUrl (file:///Users/cloudnik/.npm/_npx/48f1587babebd1f4/node_modules/@wp-now/wp-now/main.js:268:11)
    at downloadWordPress (file:///Users/cloudnik/.npm/_npx/48f1587babebd1f4/node_modules/@wp-now/wp-now/main.js:316:10)
    at startWPNow (file:///Users/cloudnik/.npm/_npx/48f1587babebd1f4/node_modules/@wp-now/wp-now/main.js:499:9)
    at async startServer (file:///Users/cloudnik/.npm/_npx/48f1587babebd1f4/node_modules/@wp-now/wp-now/main.js:724:42)
    at async Object.handler (file:///Users/cloudnik/.npm/_npx/48f1587babebd1f4/node_modules/@wp-now/wp-now/main.js:869:25)
Failed to start the server: Unrecognized WordPress version. Please use "latest" or numeric versions such as "6.2", "6.0.1", "6.2-beta1", or "6.2-RC1"

Proposed solution

  • Include the fix in the error message, e.g. Run with --wp 6.2.
  • Don't show the stack trace. It clutters the output and doesn't help me.

cc @sejas @danielbachhuber @wojtekn

@adamziel adamziel added [Type] Bug An existing feature does not function as intended Local Environment i1 labels May 22, 2023
@adamziel adamziel changed the title Local Environment: Failure to start in Gutenberg clone Local Environment: Failure to start in Gutenberg directory May 22, 2023
@danielbachhuber
Copy link
Member

Couple of funky things here:

  1. .wp-env.json supports a 'WordPress/WordPress' version value.
  2. Applying .wp-env.json values happens after yargs runs. It should probably act as default parameters.

@danielbachhuber
Copy link
Member

.wp-env.json supports a 'WordPress/WordPress' version value.

Apparently wp-env supports all of these variations:

image

Maybe we need to remove support for core until we can support all of those variations?

Alternatively, we could transform 'WordPress/WordPress' to a WordPress nightly ZIP. But this seems a little hacky.

Previously #230

danielbachhuber added a commit that referenced this issue May 22, 2023
See #405

## What?

Calls `getWpNowConfig()` on a `yargs.check()` callback to validate the
entire configuration before `start` or `php` commands are run.

## Why?

`getWpNowConfig()` can pick up additional values from `.wp-env.json`. We
want to make sure the validation of those values is caught by `yargs`.

## How?

The `yargs.check()` callback runs `getWpNowConfig()` and listens for an
exception.

I don't love that we're calling `getWpNowConfig()` twice because it
seems like some side effect could occur. However, this seems like the
most appropriate way to incorporate a check into `yargs`.

## Testing Instructions

1. Run `nx preview wp-now start --wp=invalid` and verify an error
message appears as expected.
2. Clone Gutenberg somewhere: `[email protected]:WordPress/gutenberg.git`
3. Run `nx preview wp-now start --path=/path/to/gutenberg-clone` and
verify an error message appears as expected.
4. Run `nx preview wp-now start` for a happy path and verify `wp-now`
starts as expected.
@danielbachhuber
Copy link
Member

We chatted about this a bit on our team call today. Our preference at this point is to remove .wp-env.json support entirely. In the future, we could support a .wp-now.json file, or support .wp-env.json again.

@wojtekn
Copy link
Collaborator

wojtekn commented May 22, 2023

What if we change wp-env.json in the code to wp-now.json and leave everything around it as is? Is there a strong reason to remove it, instead of using wp-now specific configuration file?

@danielbachhuber
Copy link
Member

@wojtekn I'd like to remove it to start, and leave "official support for a wp-now.json file" to a separate discussion. Here's some past discussion about it: WordPress/playground-tools#20

danielbachhuber added a commit that referenced this issue May 22, 2023
Fixes #405

## What?

Removes support for `.wp-env.json` and `.wp-env.override.json`.

## Why?

Our support for the 'core' argument is woefully incomplete
(#405 (comment)).
Rather than try to sort through all of those permutations right now,
it's easier to just remove support.

## How?

Removes a bunch of code.

## Testing Instructions

1. Tests should pass.
2. Run `git clone [email protected]:WordPress/gutenberg.git` and `nx
preview wp-now start --path=/path/to/gutenberg-clone` and verify
`wp-now` starts as expected.
@danielbachhuber danielbachhuber self-assigned this May 22, 2023
Pookie717 added a commit to Pookie717/wordpress-playground that referenced this issue Oct 1, 2023
See WordPress/wordpress-playground#405

## What?

Calls `getWpNowConfig()` on a `yargs.check()` callback to validate the
entire configuration before `start` or `php` commands are run.

## Why?

`getWpNowConfig()` can pick up additional values from `.wp-env.json`. We
want to make sure the validation of those values is caught by `yargs`.

## How?

The `yargs.check()` callback runs `getWpNowConfig()` and listens for an
exception.

I don't love that we're calling `getWpNowConfig()` twice because it
seems like some side effect could occur. However, this seems like the
most appropriate way to incorporate a check into `yargs`.

## Testing Instructions

1. Run `nx preview wp-now start --wp=invalid` and verify an error
message appears as expected.
2. Clone Gutenberg somewhere: `[email protected]:WordPress/gutenberg.git`
3. Run `nx preview wp-now start --path=/path/to/gutenberg-clone` and
verify an error message appears as expected.
4. Run `nx preview wp-now start` for a happy path and verify `wp-now`
starts as expected.
Pookie717 added a commit to Pookie717/wordpress-playground that referenced this issue Oct 1, 2023
Fixes WordPress/wordpress-playground#405

## What?

Removes support for `.wp-env.json` and `.wp-env.override.json`.

## Why?

Our support for the 'core' argument is woefully incomplete
(WordPress/wordpress-playground#405 (comment)).
Rather than try to sort through all of those permutations right now,
it's easier to just remove support.

## How?

Removes a bunch of code.

## Testing Instructions

1. Tests should pass.
2. Run `git clone [email protected]:WordPress/gutenberg.git` and `nx
preview wp-now start --path=/path/to/gutenberg-clone` and verify
`wp-now` starts as expected.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants