Home > Enterprise >  Unexpected token in jsdom when run npm build
Unexpected token in jsdom when run npm build

Time:01-23

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.

CodePudding user response:

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

  • Related