1

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).

twan
  • 2,450
  • 10
  • 32
  • 92
  • Please share the code you have here so others can see what's going on (refer to [How to create a Minimum, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example) for more details.) – cabrerahector Oct 14 '22 at 16:01

2 Answers2

1

I also had this problem. All I needed to do was to update my Node version.

I followed these steps (run in Mac Terminal):

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

Hope this helps.

Hugo S
  • 144
  • 7
0

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 returns v18.12.0)