"SyntaxError: Unexpected token ?" executing Next.JS scripts

690 Views Asked by At

I'm learning Next.JS by following the freecodecamp tutorial, and running npm run dev gives the following error output:

showAll: args["--show-all"] ?? false,
                             ^

SyntaxError: Unexpected token ?
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)

I'm running npm version 8.19.2 and node version 18.12.1, which should support null coalescing.

Grateful for any ideas.

I tried updating my node and npm versions, and ensuring they support null coalescing. According to some previous answers on here that aught to have done it.

0

There are 0 best solutions below