#SyntaxError Unexpected token '?' (I haven't even used that character!)

1 messages · Page 1 of 1 (latest)

silk hollow
#

https://replit.com/@JavascriptLearn/DiscordJSTemplate#deploy-commands.js:1:33

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/runner/DiscordJSTemplate/deploy-commands.js:1:33)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
exit status 1
pseudo osprey
#

Probably running an old Node version

silk hollow
#

Line 1 is this though:

const { SlashCommandBuilder } = require('@discordjs/builders');
pseudo osprey
#

okay

#

Still probably a node version issue

#

We require 16.6

silk hollow
#

oh no

#

v12.22.6

#

i'm on replit so I used:
npm install node@17 and it says it installed node@17.4.0

pseudo osprey
#

We dont support replit, cant really advise as to how you should be doing that

silk hollow
#

OK, but it had the same error, and if it's not a problem with Repl.IT, it looks like the package.json updated the version so idk. I was trying to switch to slash commands from something else so I'll just not use them.

pseudo osprey
#

Thats not how you update node for one

#

Its not a project dependency

heavy fjord
#

you can use node as project dependancie

#

in your package.json, add this ```json
{
"devDependencies": {
"node": "^16.14.0"
}
}

supple pumice
#

You gotta choose nodejs 16 in the create repl section

silent crystal
#

Even my bot is running on Replit... And I have no issues... @pseudo osprey