Seeing as this question is currently locked, and not accepting new answers, I thought I would address a few observations on the incompatibilities between node versions, all due credit goes to the commenters: @tipakA and @Christian.
There are incompatibilities between versions of Node, it may simply be that you need to update your VPS's version of Node to a later version, one where the catch
blocks are optional, or more precisely to one which satifies your dependancies, in light of the comment by @tipakA
v12 of discord.js indeed requried node 12 or newer - @tipakA
In addition to simply upgrading to a compatible version of Node, I would also suggest, you "preserve" the node version as a dependency in your package.json file, like:
"engines" : {
"node" : ">=0.12"
}
Ensure you, signal that your project will not work at all in lower versions of Node, with this flag
"engineStrict" : true
Now when you deploy and npm install
, you will be warned of any discrepancies in Node versions.
Unfortunately it appears that support for "engines"
is in flux between npm versions, for example they are deprecated, as of npm 3, but supported in npm v 5x..., so you may want to 'patch/polly-fill' the feature, as outlined in this article, all credit goes to 'Adam Bisek' the author of that article.
Also, this answer on StackOverflow, provides additional approaches to the Node version as dependency issue.
Alternatively, without having more insight into the stack, or the environment, I have to go with what looks obvious to me.
From the fact that this is throwing a SyntaxError
I would look at where the SyntaxError
is. To me the signature of your try catch looks off.
JavaScript has the following signature for a Try/Catch block:
try {
try_statements
}
[catch (exception_var_1 if condition_1) { // non-standard
catch_statements_1
}]
...
[catch (exception_var_2) {
catch_statements_2
}]
[finally {
finally_statements
}]
So you would need to have a try catch as such, like this
try {
// attempt to perform something here...
} catch ( e ) {
// do something with "e" or handle the error some how.
}
you can read up on this more here.