Error [ERR_REQUIRE_ESM]: require() of ES Module
So im getting this errror about 3 times for different packages
Solution:Jump to solution
for color-thief-ts, read their readme: https://github.com/wh5938316/color-thief-ts
it specifically says you need to import it differently for NodeJS.
for mime it specifically says that as of v4 it only supports ES modules at the top of the README, and you're using CommonJS: https://github.com/broofa/mime...
21 Replies
my tsconfig
package.json
Node: v18.16.1
Index.ts file
Client
Solution
for color-thief-ts, read their readme: https://github.com/wh5938316/color-thief-ts
it specifically says you need to import it differently for NodeJS.
for mime it specifically says that as of v4 it only supports ES modules at the top of the README, and you're using CommonJS: https://github.com/broofa/mime
Changed tag to "Miscellaneous" because this is not Sapphire related
what module should i use in the tsconfig?
You dont change anything in your tsconfig. This is not related to tsconfig. This is related to packages being used, exactly as I described.
This error occurs at runtime and it is therefore a nodejs error, typescript is only at build time
so what should i do?
change the type in package.json to module?
read the readmes I told you about
alright
ok i read that
although can i ask you
are those good for a discord bot?
you keep going back to tsconfig, I already told you, this is not TS related
nah i did what they did, just asking in general
in that case, sure, if you want to use CJS
what do you use?
ESM because it's the future, it comes with some minor downsides that you need to adjust your code for though. You seem like a beginner programmer so you may want to take it slowly still.
not beginner, but i hate those things about cjs and esm
sorry, I drew that conclusion from the problem you had and what the solution was (reading the readmes essentially)
there is a initialism in programming that basically answered your problem: https://en.wikipedia.org/wiki/RTFM
RTFM
RTFM is an initialism and internet slang for the expression "read the fucking manual" – typically used to reply to a basic question where the answer is easily found in the documentation, user guide, owner's manual, man page, online help, internet forum, software documentation or FAQ.
Usage is variously viewed as a pointed reminder of etiquette t...
oh haha don't worry, i just hate setting up thing about tsconfig
oh cool thanks
deep answers for deep questions :TrollFront: