Home > Back-end >  SyntaxError: Unexpected token '??=' Discord.JS Heroku
SyntaxError: Unexpected token '??=' Discord.JS Heroku

Time:01-12

When I deploy my Branch I get this error in logs

Here is the console log

Anyone can help me fix this?

CodePudding user response:

Nullish assignment is first supported in Node 15. It sounds like whatever version of Node your app is using is not to that point yet.

Specify a more recent Node version for Heroku to run in your package:

  "engines": {
    "node": "16.x"

otherwise it uses 14 by default (which is a slightly older LTS version which does not support this relatively new syntax).

CodePudding user response:

The new error might have come because discord.js was not listed in your package.json file. Try installing discord.js again and see if it works.

  •  Tags:  
  • Related