ERR_REQUIRE_ESM when using TypeScript #12

Closed
opened 2026-02-16 12:26:45 -05:00 by yindo · 1 comment
Owner

Originally created by @ohxxm on GitHub (Feb 21, 2022).

`
Error [ERR_REQUIRE_ESM]: require() of ES Module /home//node_modules/revolt.js/dist/index.js from /home//Projects//src/util/client.js not supported.
Instead change the require of index.js in /home/
/Projects//src/util/client.js to a dynamic import() which is available in all CommonJS modules.
at Object. (/home/
/Projects//src/util/client.js:13:21)
at Object. (/home/
/Projects/*/src/index.js:3:18)
at async Promise.all (index 0) {
code: 'ERR_REQUIRE_ESM'
}

Node.js v17.5.0
`
When running with ts-node, this error is outputted.

Originally created by @ohxxm on GitHub (Feb 21, 2022). ` Error [ERR_REQUIRE_ESM]: require() of ES Module /home/*/node_modules/revolt.js/dist/index.js from /home/*/Projects/*/src/util/client.js not supported. Instead change the require of index.js in /home/*/Projects/*/src/util/client.js to a dynamic import() which is available in all CommonJS modules. at Object.<anonymous> (/home/*/Projects/*/src/util/client.js:13:21) at Object.<anonymous> (/home/*/Projects/*/src/index.js:3:18) at async Promise.all (index 0) { code: 'ERR_REQUIRE_ESM' } Node.js v17.5.0 ` When running with ts-node, this error is outputted.
yindo closed this issue 2026-02-16 12:26:45 -05:00
Author
Owner

@Rexogamer commented on GitHub (Mar 19, 2022):

This is an issue with your code. You need to use ESM - more details here.

@Rexogamer commented on GitHub (Mar 19, 2022): This is an issue with your code. You need to use ESM - more details [here](https://developers.revolt.chat/revolt_js_guide/discord_js_migration#the-basics).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: stoatchat/javascript-client-sdk#12