Were you not able to convert the script to a module, or dynamically import() node-fetch?
Since you're using it for an async operation anyway, dynamic import should have worked quite well.
Re:ES modules are terrible
by theprotocol on Sunday November 07, 2021 @08:59AM
(#29139485)
I just encountered this. FYI You can use v2 which still retains commonjs support.
I wasn’t able to use the latest version of node-fetch in a node.js script since it doesn’t support commonjs. The project literally has “node” in the name and doesn’t support default node.js.