joh3rd
joh3rd

Reputation: 5

Unexpected token in jsdom when run npm build

I have a next.js app and on "npm run build" i get the following error

> Build error occurred
/var/www/directoryname/node_modules/jsdom/lib/jsdom/browser/parser/html.js:170
    after._pushedOnStackOfOpenElements?.();

SyntaxError: Unexpected token '.'

node version: v12.22.5 next.js version: v12.1.6

Many thanks for your help.

Upvotes: 0

Views: 752

Answers (1)

adsy
adsy

Reputation: 11417

You are using optional chaining syntax which is not supported on Node 12. Upgrade to at least Node 14 to get the syntactical support.

Upvotes: 1

Related Questions