Creating first bot and ran into problem
Ive already done nmp i and installed discord.js in the terminal (using VSC) and when i try to run my code it says
cannot run import statement outside a module
i did replace token with the actual token7 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!a) this syntax is v12 at best, what version are you actually using?
b)
import
is only available in esm and typescript, you want to use require
statementsdiscord.js@14.15.3
i used a template i found on replit so that might be why it looks v12
dunno where you got this code from, but it is extremely outdated. i suggest you read the official d.js guide instead of some random resource
are you talking about this
![No description](https://cdn.answeroverflow.com/1259911237995855922/image.png)
import is only available in esm and typescript, you want to use require statementswell, if they're using import, they are using ESM so ok yeah this is the point when you add type: "module" because legacy stuff