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

Update npx commands in create-block README.md #47150

Merged
merged 1 commit into from
Aug 8, 2023

Conversation

doughamlin
Copy link
Contributor

What?

Update npx commands to ensure latest version is used.

Why?

I followed these directions and it used an old version, which resulted in various flags not working.

How?

Update the readme

Testing Instructions

N/A

Update npx commands to ensure latest version is in use.

I followed these directions and it used an old version, which resulted in various flags not working.
@github-actions
Copy link

👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @doughamlin! In case you missed it, we'd love to have you join us in our Slack community, where we hold regularly weekly meetings open to anyone to coordinate with each other.

If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information.

@github-actions github-actions bot added the First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository label Jan 13, 2023
@gziolo
Copy link
Member

gziolo commented Jan 14, 2023

Thank you for the report. It looks like it was a bug on npm side: npm/cli#2329. It's been fixed shortly after v7.19.0. There is also a following note in the comments:

if you have a package globally installed, npx will find and use that before trying to install something else, and it will not automatically fetch the latest version in that case.

So maybe an alternative would be adding a note to use @latest only with older npm versions and when an older version of the package is installed globally.

@gziolo gziolo added [Tool] Create Block /packages/create-block [Type] Developer Documentation Documentation for developers labels Jan 14, 2023
@doughamlin
Copy link
Contributor Author

Is it a bug or the intended behavior of npx? Commenters in that ticket (as well as other discussions I referenced before opening this PR) don't seem to agree. Either way, it seems not ideal that someone can't copy/paste these commands and expect them to work.

For the record, I was using npx v8.1.0, and that ticket says the bug was fixed in v7.5.2. If I run npm ls -g I don't see create-block installed globally, so how would I know is installed? Yes, it is in the ~/.npm/_npx folder, but who is rummaging through their cache folder? Even after running npx @wordpress/create-block@latest, if I run it without the @latest I still get the old cached version (2.9.0 published Jun 15, 2020!).

So, it seems anyone who comes back and tries to use a new flag with npx will face a similar result as me. A note to add @latest is certainly one way, but could easily be missed.

@gziolo
Copy link
Member

gziolo commented Jan 30, 2023

In that case, it might be fine to include the @latest part to avoid all the issues mentioned.

@ryanwelcher, @juanmaguitar and @mburridge, do you agree? We might need to update more places for consistency or include a Troubleshooting section to use as a reference.

@mburridge
Copy link
Contributor

I think I would prefer a note on the page to append @latest when necessary, rather than make it part of the example commands that should, in general, work.

@juanmaguitar
Copy link
Contributor

@doughamlin Thanks for opening this PR.
These changes LGTM and will help the developer experience for create-block

@gziolo gziolo merged commit d9be9a6 into WordPress:trunk Aug 8, 2023
@github-actions
Copy link

github-actions bot commented Aug 8, 2023

Congratulations on your first merged pull request, @doughamlin! We'd like to credit you for your contribution in the post announcing the next WordPress release, but we can't find a WordPress.org profile associated with your GitHub account. When you have a moment, visit the following URL and click "link your GitHub account" under "GitHub Username" to link your accounts:

https://profiles.wordpress.org/me/profile/edit/

And if you don't have a WordPress.org account, you can create one on this page:

https://login.wordpress.org/register

Kudos!

@github-actions github-actions bot added this to the Gutenberg 16.5 milestone Aug 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First-time Contributor Pull request opened by a first-time contributor to Gutenberg repository [Tool] Create Block /packages/create-block [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants