I dont know what this error means
the error: connect.js code:
11 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!
- ✅
Marked as resolved by staff
idk if its related to discord.js but if its not pls dont close the channel and help me solve the issue
It's not discord.js-related, but as the error says, require() isn't supported as newer versions of chalk require ESM, so either install an older version of chalk or use ESM, for more help, please ask in #other-js-ts / #useful-servers
its the latest version of chalk
and whats ESM
its the first time i hear about it
In CJS (CommonJS), what you're using, you do
const ... = require("...")
but in ESM (EcmaScript Modules), you do import ... from "..."
, this is just JavaScript now and not discord.js-relatedohh alright
so i should do import chalk from "chalk" then?
nvm doesnt work cuz i cant use import outside a statement
You'd need to change that everywhere in your code and also set the type to module in package.json, and again, this isn't discord.js-related
I think there is a method that can be used to import the ESM module in CJS,
import("module-name")
, This returns a promise, so you need to resolve it first
I'm not sure if this is work or not, haven't used CJS in a whileyes ik it aint discord.js related T_T
Then please do what I said
alr sorry