-
-
Notifications
You must be signed in to change notification settings - Fork 613
Open
Description
I got an error when starting the pool
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/max/pool/node_modules/dateformat/lib/dateformat.js from /home/max/pool/lib/logger.js not supported.
Instead change the require of dateformat.js in /home/max/pool/lib/logger.js to a dynamic import() which is available in all CommonJS modules.
corrected in the file in logger.js
let dateFormat;
(async () => {
dateFormat = (await import('dateformat')).default;
})();
Starting a pool
node init.js
TypeError: dateFormat is not a function
at global.log (/home/max/pool/lib/logger.js:71:13)
at Object.<anonymous> (/home/max/pool/init.js:24:2)
at Module._compile (node:internal/modules/cjs/loader:1546:14)
at Object..js (node:internal/modules/cjs/loader:1689:10)
at Module.load (node:internal/modules/cjs/loader:1318:32)
at Function._load (node:internal/modules/cjs/loader:1128:12)
at TracingChannel.traceSync (node:diagnostics_channel:315:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:170:5)
at node:internal/main/run_main_module:36:49
/home/max/pool/lib/exceptionWriter.js:22
let time = dateFormat(toISOString(), 'yyyy-mm-dd hh:MM:ss');
^
ReferenceError: toISOString is not defined
at process.<anonymous> (/home/max/pool/lib/exceptionWriter.js:22:14)
How can this be fixed?
Metadata
Metadata
Assignees
Labels
No labels