Unexpected token '?' in v7.1

89 views
Skip to first unread message

a.st...@gmail.com

unread,
Oct 26, 2022, 10:04:56 PM10/26/22
to nodeGame
Hi Stefano,

Hope all's well. I'm in the process of updating to 7.1 from 6.3 and running into the below error regarding an unexpected token '?' in line 59 of lib/ServerNode.js:

this.nodeGameRoot = opts.nodeGameRoot ??
path.resolve(this.rootDir, '..', '..');

The full error msg can be found below. I'm thinking it might have something to do with my vscode configuration, but the interpreter is clearly set to javascript. If I comment out that line, a new error springs in its place (Error: Could not load requested format: csv). For completeness, the nodeGameRoot variable does not exist in the same function in v6.3.

Do you have any thoughts on how to further troubleshoot this issue?

All the best,
Arjen



----
xxx nodegame-v7.1.0 % node launcher.js
xxx/nodegame-v7.1.0/node_modules/nodegame-server/lib/ServerNode.js:59
    this.nodeGameRoot = opts.nodeGameRoot ??
                                           ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:1070:16)
    at Module._compile (internal/modules/cjs/loader.js:1120:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
    at Module.load (internal/modules/cjs/loader.js:1000:32)
    at Function.Module._load (internal/modules/cjs/loader.js:899:14)
    at Module.require (internal/modules/cjs/loader.js:1042:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (/Users/arjsto/Projects/Web/software/nodegame-v7.1.0/node_modules/nodegame-server/index.js:10:22)
    at Module._compile (internal/modules/cjs/loader.js:1156:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)

shakty

unread,
Oct 27, 2022, 8:55:10 AM10/27/22
to nodeGame
Hi Arjen,

That's the nullish coalescing operator for JavaScript, which is available from Node 14.x:


You should update node and it will work.

Cheers,
Stefano

a.st...@gmail.com

unread,
Oct 27, 2022, 11:06:16 AM10/27/22
to nodeGame
Wonderful, that solved it!
Reply all
Reply to author
Forward
0 new messages