audiobookbay icon indicating copy to clipboard operation
audiobookbay copied to clipboard

Error [ERR_REQUIRE_ESM]: require() of ES Module

Open Oladapodaniel opened this issue 1 year ago • 0 comments

Hello, i just installed the library, i calling the explore endpoint, but i get an error

/Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/dist/utils/searchAudiobooks.js:17 const node_fetch_1 = __importDefault(require("node-fetch")); ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/node_modules/node-fetch/src/index.js from /Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/dist/utils/searchAudiobooks.js not supported. Instead change the require of index.js in /Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/dist/utils/searchAudiobooks.js to a dynamic import() which is available in all CommonJS modules. at Object. (/Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/dist/utils/searchAudiobooks.js:17:38) at Object. (/Users/apple/Documents/react-native/audiobook/server/node_modules/audiobookbay/dist/index.js:16:28) at async Promise.all (index 0) { code: 'ERR_REQUIRE_ESM' }

how can this be fixed, I'm new to this. Thanks.

Oladapodaniel avatar Feb 26 '24 17:02 Oladapodaniel