colyseus/tutorial-phaser

Syntax error on server "npm start"

meltzow opened this issue · 2 comments

after checkout and running "npm install" in server directory, this error message was thrown on running "npm start":

/usr/bin/npm run start

> my-app@1.0.0 start
> ts-node-dev --respawn --transpile-only src/index.ts

[INFO] 13:43:32 ts-node-dev ver. 1.1.8 (using ts-node ver. 9.1.1, typescript ver. 4.6.3)
/home/mario/git/tutorial-phaser/server/node_modules/@colyseus/arena/build/index.js:37
        path__default['default'].resolve(path__default['default'].dirname(require?.main?.filename || process.cwd()), "..", envFilename),
                                                                                  ^

SyntaxError: Unexpected token '.'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Module._compile (/home/mario/git/tutorial-phaser/server/node_modules/source-map-support/source-map-support.js:568:25)
    at Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at require.extensions..jsx.require.extensions..js (/tmp/ts-node-dev-hook-5715882422067253.js:114:20)
    at Object.nodeDevHook [as .js] (/home/mario/git/tutorial-phaser/server/node_modules/ts-node-dev/lib/hook.js:63:13)
    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)
[ERROR] 13:43:33 SyntaxError: Unexpected token '.'
^C
Process finished with exit code 130 (interrupted by signal 2: SIGINT)

any ideas to fix it?

endel commented

Hi @meltzow, you're probably using Node.js v12, which is not supported anymore, I recommend always using Node.js LTS, which currently is Node.js v16

thx, you're right. it's working now after using node.js LTS.