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

@wordpress/create-block - 'wp-create-block' is not recognized as an internal or external command, operable program or batch file. #38793

Closed
andornagy opened this issue Feb 14, 2022 · 9 comments
Labels
[Package] Create Block /packages/create-block

Comments

@andornagy
Copy link

andornagy commented Feb 14, 2022

Description

Every time I try to run

npx @wordpress/create-block boilerplate

I get the following error:

'wp-create-block' is not recognized as an internal or external command,
operable program or batch file.

I have node.js version 16.14.0 and npm version 8.5.0.

All other npm commands work just fine. same with the npx create-react-app my-app

Step-by-step reproduction instructions

  1. Go to the plugins folder of a WordPress installation
  2. Open the terminal
  3. run npx @wordpress/create-block boilerplate

Environment info

Node.js version 16.14.0
Npm version 8.5.0.
Windows 10 PRO version 21h2
LocalWP version 6.2.1+5711

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

@talldan talldan added [Package] Create Block /packages/create-block Needs Testing Needs further testing to be confirmed. labels Feb 15, 2022
@talldan
Copy link
Contributor

talldan commented Feb 15, 2022

@andornagy Thanks for reporting this. I tested node 14 and 16 and both seemed to work ok, but then I'm on a mac.

So it sounds like there might be an issue on Windows. Are you using the standard Windows command prompt? Or one of the linux subsystems for Windows?

I remember @gziolo recently added some testing for create block on Windows and ran into some issues, so might have some ideas about this - #38368.

@talldan
Copy link
Contributor

talldan commented Feb 15, 2022

#38781 could be related.

@t-hamano, does your PR fix this issue?

@t-hamano
Copy link
Contributor

@talldan
My PR is for a fix to resolve the path separator, so this PR probably won't fix this issue.
Also, I have never encountered an error message for this problem, but I expect it to be an OS or terminal issue.
I would like to do some research to see what environment I can reproduce it in.

@andornagy
Copy link
Author

@talldan I tried the base windows terminal and power shell. Both as normal and run as admin. Same issue. And the same with the built-in terminal from VS Code.

And I never used the Linux Subsystems before, no.

@t-hamano
Copy link
Contributor

@andornagy

I've tested the same version of npm and node, but I can't reproduce the problem.

Could you tell me what version of npx you are using?
If you haven't explicitly included npx, it should be the same version as npm.

> npx -v
8.5.0

Also, do you see any other messages immediately after executing the command?

@andornagy
Copy link
Author

andornagy commented Feb 15, 2022

@andornagy

I've tested the same version of npm and node, but I can't reproduce the problem.

Could you tell me what version of npx you are using? If you haven't explicitly included npx, it should be the same version as npm.

> npx -v
8.5.0

Also, do you see any other messages immediately after executing the command?

Npx version is 8.5.0 as well. And no, just to run a new command.

Also interesting, because I just tested on my laptop, a Lenovo IdeaPad Y910, just installed Node.js on it:
Node version: 16.14.0
NPM version: 8.3.1
NPX version: 8.3.1
Windows version: 21H1

And it works just fine, for any terminal.

I might try downgrading to npm 8.3.1 and see. If not, I wanted to re-install Windows anyways, maybe that could fix it.

Same results with npm/npx 8.3.1

E:\Projects\gutenberg\app\public\wp-content\plugins>npx @wordpress/create-block test
'wp-create-block' is not recognized as an internal or external command,
operable program or batch file.

E:\Projects\gutenberg\app\public\wp-content\plugins>

@t-hamano
Copy link
Contributor

@andornagy

I'll describe the method I came up with.

I've listed them in order of least impact on the computer environment.

Clear npx cache

run npx clear-npx-cache

Uninstall local @wordpress/create-block package

This may be due to the fact that it is installed globally by npm.
npm rm -g @wordpress/create-block

Reinstall node.js

Please note that this may affect your existing local projects.

@andornagy
Copy link
Author

Thank you, this seems to have fixed the issue.

And my other projects work just fine as well :)

Could have this been caused by me trying the newest version of the "current" nodejs? 17.5.0 and then reverting to the stable one? And maybe leaving a corrupted cache or something?

@gziolo gziolo closed this as completed Feb 15, 2022
@t-hamano
Copy link
Contributor

@andornagy
I also tested it with node v17.5.0 and it worked fine.
I don't know what caused it, but it may have been a temporary environmental issue, not the node version.
In any case, I'm glad it was resolved 👍

@t-hamano t-hamano removed the Needs Testing Needs further testing to be confirmed. label Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Package] Create Block /packages/create-block
Projects
None yet
Development

No branches or pull requests

4 participants