i might be a bit late, but this problem still persist till today (2024-11-19), this actually turns out to be the node's fault; as a matter of fact, node 18, 20 and 22 all have the same problems. you can either downgrade to node 16; or, you can add "type":"commonjs"in your package.json file, and change your files to ".js", normally, this is fine, unless you have "await" functions in your top level file.