Hey guys,
We have a working 0.58.2 version (n 4.5) and are looking to go towards 0.63.0, after seeing Aaron’s answer here (https://stackoverflow.com/questions/48917334/updating-a-manually-installed-rocket-chat-instance) we went ahead and updated node to 4.8.4, then 8.9.3 (as recommended), to finally deploy the 0.63.0 code & npm install/reinstall the forever services.
Once that’s done, we’re getting:
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
In the logs, on startup. Anyone experienced this? Any clues to point us in the right direction?
Any help highly appreciated.
Sounds like you have an incompatible Node version running, as the import
item it is talking about is a newer Node/JavaScript feature. Make sure the environment where your Rocket.Chat Server is running in is actually the updated Node version.
2 Likes
Sorry for the late reply, our time to work on this is unfortunately very limited.
So I’ve made some progress, but still getting the same error. nodejs was updated using:
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
apt-get install nodejs
n 8.11.1
From this,
nodejs -v && node -v
reports 8.11.1 on both & now npm install runs but ends with
npm WARN lifecycle Rocket.Chat@0.62.0~postinstall: cannot run in wd %s %s (wd=%s) Rocket.Chat@0.62.0 cd packages/rocketchat-katex && npm i /var/www/Rocket.Chat
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
That being said, I also tried both
npm install --unsafe-perm
and just
npm install
Running with unsafe perm doesn’t result in the first warning, and both unsafe and regular result in the following after setting up the forever services:
error: Script restart attempt #5
/var/www/Rocket.Chat/server/main.js:1
(function (exports, require, module, __filename, __dirname) { import '/imports/startup/server';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Function.Module.runMain (module.js:693:10)
at startup (bootstrap_node.js:188:16)
at bootstrap_node.js:609:3
error: Forever detected script exited with code: 1
Any ideas?
Did you manage to solve? Still looks like despite being updated it wasn’t using that updated node.js
Another thing to try is make sure you delete the node_modules folder and rerun npm install
Hey Aaron,
I did not, we’re still running that old version. Thanks for the info! I’ll try over the weekend & come back with anything else that pops up.
Cheers,
Simon