I am trying to create a custom gutenberg block to use in the wordpress gutenberg editor but when trying the command: npx @wordpress/create-block test-block
it starts with installing a few things but all of a sudden I get:
npx: installed 126 in 13.341s
Unexpected token .
What is causing this?
I am following this tutorial: https://kinsta.com/blog/gutenberg-blocks/ except I am not using any of the hosting options from the tutorial since I have my own wordpress installation already running (locally).
2
Answers
For folks on Ubuntu: I ran into the same issue and found that the nodejs installable via apt is out of date. I had to download the tarfile from nodejs.org and install it with the help of How to install node.tar.xz file in linux. After that it ran as I expected.
(I tried the LTS version.
node --version
returnsv18.12.0
)I also had this problem. All I needed to do was to update my Node version.
I followed these steps (run in Mac Terminal):
Hope this helps.