With the latest stable Rocket Chat (0.60.3) on Centos 7 machine I got this error :


# 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.<anonymous> (/opt/Rocket.Chat/main.js:4:1)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

This can be fixed by installing a few dependency (magic)

npm install -g inherits n

Then it seems to be recommended to run node.js 8.9.3 :

n 8.9.3

After that I got greeted with a well-known issue on Centos … the older GLIBC librarys :

[root@rocket Rocket.Chat]# node main.js
module.js:664
  return process.dlopen(module, path._makeLong(filename));
                 ^

Error: /lib64/libstdc++.so.6: version `GLIBCXX_3.4.20' not found (required by /opt/Rocket.Chat/programs/server/node_modules/fibers/bin/linux-x64-57/fibers.node)
    at Object.Module._extensions..node (module.js:664:18)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/opt/Rocket.Chat/programs/server/node_modules/fibers/fibers.js:24:38)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)

Luckily in this case there is a quick and easy workaround, install some build apps in case they are missing :

yum install g++ build-essential

rebuild node-gyp :

npm install -g node-gyp
cd /opt/Rocket.Chat/programs/server/node_modules/fibers/
node-gyp rebuild
cp -f build/Release/fibers.node bin/linux-x64-57/fibers.node

And rocketchat will boot up again 😀 jippie !

systemctl start rocketchat.service

Happy rocketing ! 🙂

Thanks to stally!