Tailwindcss 4 and HUGO build error

Hello

I’m trying to install this theme Hugoplate.
I got this error


Built in 919 ms
Error: error building site: TAILWINDCSS: failed to transform "/css/main.css" (text/css):  
 (node:13942) Warning: To load an ES module,  
set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
ReferenceError: structuredClone is not defined

go version go1.24.0 linux/amd64
hugo v0.144.1-a79d63a44659b6bc76dcdf223de1637e0bd70ff6+extended linux/amd64 BuildDate=2025-02-18T12:14:07Z VendorInfo=snap:0.144.1
Node.js v22.14.0

PS

After I add “type”: “module” in the package.json
I got this error:
Error: error building site: TAILWINDCSS: failed to transform "/css/main.css" (text/css): ReferenceError: structuredClone is not defined

How can I fix this error?
Thanks!

I have no idea. I’m guessing some mysterious Node setup issue on your PC.

It would be useful if you could try to clone + run this site and see if you get the same error:

The site you provided works fine with no errors.

Start building sites …
hugo v0.144.1-a79d63a44659b6bc76dcdf223de1637e0bd70ff6+extended linux/amd64 BuildDate=2025-02-18T12:14:07Z VendorInfo=snap:0.144.1

               | EN  

-------------------±----
Pages | 1
Paginator pages | 0
Non-page files | 0
Static files | 0
Processed images | 0
Aliases | 0
Cleaned | 0

Built in 1645 ms
Environment: “development”
Serving pages from disk
Running in Fast Render Mode. For full rebuilds on change: hugo server --disableFastRender
Web Server is available at http://localhost:1313/ (bind address 127.0.0.1)
Press Ctrl+C to stop

OK, that adds to the mystery … It means that the latest Tailwind works fine on our box … I may try that theme myself tomorrow, but I have no further ideas for you at this moment.

Thanks for your help, I look forward to hearing from you.

1 Like

It works fine if I follow the author’s instructions:

git clone --recurse-submodules https://github.com/zeon-studio/hugoplate
cd hugoplate
npm run project-setup
npm install
npm run dev
2 Likes

I tried again and got the same error.
Maybe I’ve got some misconfiguration of the pc.

What versions of Node, Hugo and Go do you use?

hugo version
# hugo v0.144.2-098c68fd18f48031a7145bedab30cbaede48858f+extended linux/amd64 BuildDate=2025-02-19T12:17:04Z VendorInfo=gohugoio

node -v
# v22.14.0

go version
# go version go1.24.0 linux/amd64

You might try clearing your module cache:

hugo mod clean -all

Or even your entire cacheDir.

I’m pretty sure this isn’t Hugo Module related. Deleting node_modules and and doing the npm install may be. a trick.

Clearing cache didn’t work.

Reinstalled node_modules - didn’t help.

Sorry. I didn’t see this until just now.

Use a different installation method until we can fix this.

1 Like

Thanks, this worked!

1 Like

The snap package is fixed; available with the next release.