Rocket.chat: Meteor Error: Unexpected token: const { pause } = require("./debug.js");

Created on 28 Dec 2017  路  5Comments  路  Source: RocketChat/Rocket.Chat

Description:

Server Setup Information:

  • Version of Rocket.Chat Server: 0.60.1
  • Operating System: Ubuntu
  • Deployment Method(snap/docker/tar/etc): tar
  • Number of Running Instances: 1
  • DB Replicaset Oplog: none
  • Node Version: 4.8.4

Steps to Reproduce:

node main.js

/opt/Rocket.Chat/programs/server/boot.js:50
const { pause } = require("./debug.js");
^

SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/opt/Rocket.Chat/main.js:4:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

Most helpful comment

Right you are! The startup script was calling node instead of nodejs. One simple change and the server is back up. Thank @TwizzyDizzy

Edit:

The Node version being 4.8.4 was a result of the installation documentation: https://rocket.chat/docs/installation/manual-installation/ubuntu/ .

Specifically, the command: sudo n 4.8.4

All 5 comments

This is probably due to the upgrade to nodejs8 (mentioned in the release blog post). So you first need to upgrade to nodejs8 before running >= 0.60.x.

So this issue is probably obsolete and you can close it, as soon as you have verified that it works with nodejs8 (which will most probably be the case).

Cheers
Thomas

I have the same issue. Though, I have upgraded to NodeJS 8.9.3.

root@chat:/Rocket.Chat# node -v
v4.8.4
root@chat:/Rocket.Chat# nodejs -v
v8.9.3
root@chat:/Rocket.Chat# npm -v
5.5.1
root@chat:/Rocket.Chat# ls
main.js  programs  README  server  star.json
root@chat:/Rocket.Chat# node main.js
/Rocket.Chat-old/programs/server/boot.js:50
    const { pause } = require("./debug.js");
          ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Rocket.Chat-old/main.js:4:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

@therealgill Are you sure your RC instance is started with the command nodejs (which would indeed be version 8.9.3 in your case)? My hunch is, that you still start RC with the node command... leading to this error that - as mentioned above - is caused by running RC with node versions < 8.

In usual setups, the output of node -v vs. the output of nodejs -v should return the same result.

Cheers
Thomas

Right you are! The startup script was calling node instead of nodejs. One simple change and the server is back up. Thank @TwizzyDizzy

Edit:

The Node version being 4.8.4 was a result of the installation documentation: https://rocket.chat/docs/installation/manual-installation/ubuntu/ .

Specifically, the command: sudo n 4.8.4

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  3Comments

mattlin picture mattlin  路  3Comments

brendanheywood picture brendanheywood  路  3Comments

zeigerpuppy picture zeigerpuppy  路  3Comments

Buzzele picture Buzzele  路  3Comments