Unexpected token ILLEGAL

I had a bot working on my personal computer for awhile now but just recently tried to deploy it on a Vultr server running Ubuntu 18.04 and when trying to run the bot I am getting the following

                this.log.warn(`Could not parse message with no prefix:\n${
SyntaxError: Unexpected token ILLEGAL
    at Module._compile (module.js:439:25)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/root/node_modules/tmi.js/index.js:12:9)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

Not sure what the issue is. I have made sure I am running the latest versions and I have made sure my oauth token was correct.

The arrow ^ is pointing to the backtick ` so usually when an error occurs like this that means it can’t find the closing backtick and/or single/double quote (whichever one you are using). So check and make sure a closing backtick ` is present and that any special characters matching the one you’re using to wrap the string within’ your argument being passed to this.log.warn() are being escaped with a backslash \ to prevent such an error.

Hopefully that helped!

Hey thanks for the reply, unfortunately that didn’t really fix my issue, or I am not sure how to use what you told me to solve it. Would I need to fix something within the tmi package?

Something I forgot to mention was “Unexpected Token ILLEGAL” isn’t referring the oauth token you provide to connect to Twitch. It’s in reference to the problem starting at the backtick `

Also I should have added that the arrow ^ pointing to the start of the function could also mean the problem lies within’ the whatever is calling the method.

With that being said, I really cannot tell where the problem is truly occurring without some sample code that is being executed right before the error occurs.

I want to think its an issue with how I set up my server because running it locally doesn’t give me any errors.

Is the bot at least connecting to the Twitch IRC servers?

No. So I stripped it down to the bare minimum and its now giving me a UnhandledPromiseException now. I uploaded the stripped down version to HERE. Wasn’t sure if I should make a new post or just add to this one. What doesn’t make sense to me is its working perfectly on my local machine just not the Vultr server.

Honestly, this is beyond me. The problem could be a multitude of things and without the source code I cannot further diagnose the issue.

Which version of Node.js are you running?

I’m assuming the latest from their initial question.

The error OP is getting is to do with template string literals which are only available from Node v4.x and on. I’ve gotten this error reported to the repo a lot in the past.

“Updated to node 4.0, fixed.”

Now that you bring that up. I remember installing node on linux before using apt or apt-get and it installed an old version of node rather than the latest. That could definitely be a possibility here.

For the record,

SyntaxError: Unexpected token ILLEGAL

means the parser encountered a character it didn’t know how to handle there.

It being a backtick (`) that starts a string immediately points to the version of Node not supporting that syntax, which means the installed Node is years out of date.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.