skip to Main Content

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


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

    Login or Signup to reply.
  2. 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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search