Jay
Jay
NNovu
Created by Jay on 2/8/2025 in #💬│support
ERR_REQUIRE_ESM axios error with @novu/node package
I'm using v2.0.6 of the @novu/node package in my express application and when I run the novu.trigger() command, I get the following error:
/Projects/dashboard/node_modules/@novu/node/build/main/lib/novu.js:1
Error [ERR_REQUIRE_ESM]: require() of ES Module /Projects/dashboard/node_modules/@novu/node/node_modules/axios/index.js not supported.
Instead change the require of index.js in null to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Projects/dashboard/node_modules/@novu/node/build/main/lib/novu.js:49:31) {
code: 'ERR_REQUIRE_ESM'
}
/Projects/dashboard/node_modules/@novu/node/build/main/lib/novu.js:1
Error [ERR_REQUIRE_ESM]: require() of ES Module /Projects/dashboard/node_modules/@novu/node/node_modules/axios/index.js not supported.
Instead change the require of index.js in null to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Projects/dashboard/node_modules/@novu/node/build/main/lib/novu.js:49:31) {
code: 'ERR_REQUIRE_ESM'
}
I've worked around this by creating a proxy wrapper around Novu to handle the axios import but is there any better solution? I'm on node v20.15.1
12 replies