'Unable to run executable file for windows in electronJs

I am trying to generate .exe file for windows in electronJs. For this I am using electron-builder and electron-packager. when I run command(npm run package-win), It generates release-build folder inside root directory of project with .exe file but when I am trying to run this .exe file its throw an import error(screenshot attached) [https://i.stack.imgur.com/4UZtp.png][1]

As I explored and found that for this we can use "type": "module" in package.json or with script tag. I tried this solution but its giving another error (screenshot attached) [ https://i.stack.imgur.com/18mku.png][1]



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source