Skip to content
← Back to Community
SyntaxError: Unexpected token '?'
Profile icon
sergihejo

I'm trying to run my discord bot, but everytime I try it the console gives me this error:
/home/runner/TrapezonBOT/node_modules/discord.js/src/rest/RESTManager.js:32
const token = this.client.token ?? this.client.accessToken;
^
SyntaxError: Unexpected token '?'

I have my token as an Environment Variable.
How can I fix that error?

Thank you.

Answered by xyzTeam1 [earned 5 cycles]
View Answer
Voters
Profile icon
sergihejo
Profile icon
Sr-Pedrocas
Comments
hotnewtop
Profile icon
xyzTeam1
Profile icon
ethancm6

@xyzTeam1 It worked for me, thanks!

Profile icon
sergihejo

Thanks, @xyzTeam1

Profile icon
MePlayzGames

@xyzTeam1 How do you install [email protected]? I'm new to js.

Profile icon
JhalakVerma

it is not working for me
i'm getting the same error tried using [email protected] but it's showing no longer supported