Error: ERR_REQUIRE_ESM -- openmrs-esm-template-app

I am new to openMRS Environment and I am trying to Create a frontend module using this template but I am getting this error while running OpenMRS ESM Template App. Please help me out.

[HPM] Proxy created: (path) => {
        return new RegExp(`${apiUrl}/.*`).test(path) && !indexHtmlPathMatcher.test(path);
    }  -> https://dev3.openmrs.org
[openmrs] Listening at http://localhost:8080
[openmrs] SPA available at http://localhost:8080/openmrs/spa
node:internal/process/promises:391
    triggerUncaughtException(err, true /* fromPromise */);
    ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/technicise53/code/openmrs-esm-template-app/node_modules/open/index.js from /home/technicise53/code/openmrs-esm-template-app/node_modules/openmrs/dist/commands/develop.js not supported.
Instead change the require of index.js in /home/technicise53/code/openmrs-esm-template-app/node_modules/openmrs/dist/commands/develop.js to a dynamic import() which is available in all CommonJS modules.
    at /home/technicise53/code/openmrs-esm-template-app/node_modules/openmrs/dist/commands/develop.js:145:55 {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.18.3

Please upgrade your Node version to v20.19.0 or newer.

2 Likes

It works. Thank you.