Error:
internal/modules/cjs/loader.js:1153
throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js
require() of ES modules is not supported.
require() of C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js from C:\Users\Coladaclean\Desktop\billetero\node_modules\encrypted-smiley-secure-protocol\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.
Instead rename C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\package.json.
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:13)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (C:\Users\Coladaclean\Desktop\billetero\node_modules\encrypted-smiley-secure-protocol\index.js:7:21)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14) {
Getting the ERR_REQUIRE_ESM error when trying to import the module
Code: `const sspLib = require("encrypted-smiley-secure-protocol");
let eSSP = new sspLib({ id: 0x00, debug: false, timeout: 3000, fixedKey: "0000000000000000", });
eSSP .open("COM8") .then(() => console.log("Device connected!")) .catch((e) => console.log(
Error: ${e}
));`Error: internal/modules/cjs/loader.js:1153 throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); ^
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js require() of ES modules is not supported. require() of C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js from C:\Users\Coladaclean\Desktop\billetero\node_modules\encrypted-smiley-secure-protocol\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. Instead rename C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from C:\Users\Coladaclean\Desktop\billetero\node_modules\random-prime\package.json.
code: 'ERR_REQUIRE_ESM' }