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

Env: Error in readWordPressVersion #43222

Closed
swissspidy opened this issue Aug 15, 2022 · 5 comments · Fixed by #43133
Closed

Env: Error in readWordPressVersion #43222

swissspidy opened this issue Aug 15, 2022 · 5 comments · Fixed by #43133
Labels
[Tool] Env /packages/env [Type] Bug An existing feature does not function as intended

Comments

@swissspidy
Copy link
Member

Description

It looks like either #41780 or #42826 broke wp-env usage for the Preferred Languages feature plugin.

Trying to update to @wordpress/env 5.1.0 (which includes this change) breaks wp-env start with this error:


✖ Cannot read property 'path' of null
TypeError: Cannot read property 'path' of null
    at readWordPressVersion (/home/runner/work/preferred-languages/preferred-languages/node_modules/@wordpress/env/lib/wordpress.js:251:14)
    at start (/home/runner/work/preferred-languages/preferred-languages/node_modules/@wordpress/env/lib/commands/start.js:138:4)

Step-by-step reproduction instructions

Using a wp-env config file like this:

{
	"core": null,
	"plugins": [ "." ]
}

Try to run wp-env start

Screenshots, screen recording, code snippet

No response

Environment info

@wordpress/env 5.1.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

@swissspidy swissspidy added [Type] Bug An existing feature does not function as intended [Tool] Env /packages/env labels Aug 15, 2022
@t-hamano
Copy link
Contributor

t-hamano commented Aug 15, 2022

I ran into the same problem.
I believe it is due to the fact that #42826 no longer allows null in the core property.

https://github.com/WordPress/gutenberg/pull/42826/files#r933608144

I consider this to be a breaking change and believe that either of the following actions should be taken:

  • Specify in the changelog that it is a breaking change. In addition, properly update the README of the package
  • Add fallback to allow null values

It is also strange that phpVersion allows null while core does not.

Personally, I think both properties should accept null.

@noahtallen
@gziolo

I'd like to hear your thoughts 🙂

@noahtallen
Copy link
Member

Actually already have a fix here: #43133

@noahtallen
Copy link
Member

The fix will allow null again -- it was just an oversight on my part that it didn't work in the first place.

@noahtallen
Copy link
Member

By the way, for what it's worth, "core": null, has no effect by itself in a plain .wp-env.json. The absence of the core property means the same thing, which is to use the stable version. However, it is useful in .wp-env.override.json if you want to "clear" the version the environment has and instead use whatever the latest stable version is.

@noahtallen
Copy link
Member

The fix should now be available in version 5.1.1 :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Tool] Env /packages/env [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