Home > Enterprise >  const token = this.client.token ?? this.client.accessToken; SyntaxError: Unexpected token '?�
const token = this.client.token ?? this.client.accessToken; SyntaxError: Unexpected token '?�

Time:09-28

I have the latest node version installed v16 and when i start the bot with the run button or the console it brings me this error:

const token = this.client.token ?? this.client.accessToken;
                                     ^

SyntaxError: Unexpected token '?' 

But when using shell and typing in node index.js it works fine. So I don't understand what's repl.it so upset about when all is up-to-date?

CodePudding user response:

Run npm install node@16 in shell

Create a file called .replit

Inside the .replit file, add run = "npx node index.js". If your main file has a different name change index.js to your main file's name.

Now when you click run, replit uses node.js v16 instead of v12

  • Related