I upgraded to 12.0.2 and gave this error, what do I do?

} catch {
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions…js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object. (/rbd/pnpm-volume/72b771ff-26e2-402a-af17-c1eb7114d668/node_modules/.registry.npmjs.org/discord.js/12.0.2/node_modules/discord.js/src/index.js:8:11)

Hey @FayntFoto,

I think you need to use the catch like this:

} catch (error) {

Hope this helps!

This is an issue is caused by one of the modules you’re using; specifically, discord.js. I took a quick look at the documentation—you should always do this when using a library—and realized it requires Node.js 12.0.0 or above in order to use.

How can you make sure you’re using Node.js 12.0.0 or above? There are several Node.js versions available to use on Glitch. By default, Glitch selects version 10.0.0. To change the version Glitch selects for your project to version 12.0.0, add this portion to your package.json file in your project:

  "node": "12.0.0"

You may need to add a comma after whatever entry to append the portion to. For example:

"scripts": {
  "start": "node server.js"
} // Note how there's no comma here
"scripts": {
  "start": "node server.js"
}, // Note how there is a comma here now
"engines": {
  "node": "12.0.0"

Can you show the affected code?