skip to Main Content

I created a brand new reactJS application via these instructions, ran npm i && npm run dev and I get:

/home/www/node_modules/next/dist/cli/next-dev.js:362
            showAll: args["--show-all"] ?? false,
                                         ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.dev (/home/www/node_modules/next/dist/lib/commands.js:10:30)
    at Object.<anonymous> (/home/www/node_modules/next/dist/bin/next:141:28)
    at Module._compile (internal/modules/cjs/loader.js:999:30)

2

Answers


  1. You’re using a version of Node.js that doesn’t support this operator. Either replace this operator with equivalent code in your code base or update your Node.js version.

    Login or Signup to reply.
  2. Nullish coalescing (??) is supported from Node.js >= 14.x consider updating your Node.js version, or use nvm and nvm use VERSION.

    Edit:

    Next.js v13 dropped support for Node.js 12 and sets the minimum version to 14.6.0(see the release notes)

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