node.jselectronelectron-forge

SyntaxError: Unexpected token '?' when creating new app using electron-forge


I had trying to create a new app with the new electron forge version 6, and I get a error when trying to create a app that says

C:\Users\....\AppData\Roaming\npm-cache\_npx\4876\node_modules\create-electron-app\node_modules\listr2\dist\index.cjs:90
    this.path = [...task.listr.path ?? [], task.title].join(" > ");
                                     ^

SyntaxError: Unexpected token '?'

If I guess if npm itself had something to do with it, I am running 6.14.6


Solution

  • Your Node version is too low. You should update it. Not knowing which OS you're on, I encourage you to read the official documentation about updating node.js: https://nodejs.org/en/download/

    The minimum version working is node.js 14.x (https://nodejs.org/download/release/v14.21.1/)