Issue with running Node.js application on Render

Dear Render Support,

I am writing to report an issue I encountered while running my Node.js application on Render. The application is throwing the following error:M at Object.Module._extensions…js (internal/modules/cjs/loader.js:1085:13)
May 17 10:58:39 PM at Module.load (internal/modules/cjs/loader.js:933:32)
May 17 10:58:39 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
May 17 10:58:39 PM at Module.require (internal/modules/cjs/loader.js:957:19)
May 17 10:58:39 PM at require (internal/modules/cjs/helpers.js:88:18)
May 17 10:58:39 PM at Object. (/opt/render/project/src/index.js:12:15)
May 17 10:58:39 PM at Module._compile (internal/modules/cjs/loader.js:1068:30)
May 17 10:58:39 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1097:10)
May 17 10:58:39 PM at Module.load (internal/modules/cjs/loader.js:933:32)
May 17 10:58:39 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14) {
May 17 10:58:39 PM code: ‘ERR_REQUIRE_ESM’
May 17 10:58:39 PM }
May 17 10:58:46 PM ==> Starting service with ‘node index.js’
May 17 10:58:48 PM internal/modules/cjs/loader.js:1085
May 17 10:58:48 PM throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
May 17 10:58:48 PM ^
May 17 10:58:48 PM
May 17 10:58:48 PM Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /opt/render/project/src/node_modules/node-fetch/src/index.js
May 17 10:58:48 PM require() of ES modules is not supported.
May 17 10:58:48 PM require() of /opt/render/project/src/node_modules/node-fetch/src/index.js from /opt/render/project/src/index.js is an ES module file as it is a .js file whose nearest parent package.json contains “type”: “module” which defines all .js files in that package scope as ES modules.
May 17 10:58:48 PM Instead rename /opt/render/project/src/node_modules/node-fetch/src/index.js to end in .cjs, change the requiring code to use import(), or remove “type”: “module” from /opt/render/project/src/node_modules/node-fetch/package.json.
May 17 10:58:48 PM
May 17 10:58:48 PM at Object.Module._extensions…js (internal/modules/cjs/loader.js:1085:13)
May 17 10:58:48 PM at Module.load (internal/modules/cjs/loader.js:933:32)
May 17 10:58:48 PM at Function.Module._load (internal/modules/cjs/loader.js:774:14)
May 17 10:58:

I’ve managed to fix the issue using Axios, and now everything is working perfectly fine. Thank you

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.