Whenever I try to run the slice-machine now, I get this error:
[slice-machine] /Users/marcokuehbauch/development/dieda-website/node_modules/slice-machine-ui/build/server/src/index.js:141
undefined
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/marcokuehbauch/development/dieda-website/node_modules/node-fetch/src/index.js from /Users/marcokuehbauch/development/dieda-website/node_modules/slice-machine-ui/build/server/src/index.js not supported.
Instead change the require of /Users/marcokuehbauch/development/dieda-website/node_modules/node-fetch/src/index.js in /Users/marcokuehbauch/development/dieda-website/node_modules/slice-machine-ui/build/server/src/index.js to a dynamic import() which is available in all CommonJS modules.
at Object.newLoader [as .js] (/Users/marcokuehbauch/development/dieda-website/node_modules/pirates/lib/index.js:141:7)
at Object. (/Users/marcokuehbauch/development/dieda-website/node_modules/slice-machine-ui/build/server/src/index.js:16:38) {
code: 'ERR_REQUIRE_ESM'
When I remove my node-fetch implementation completely and run npm run slicemachine again, the slicemachine works again.
Why are these related and do you have any idea, how I solve this?
Tracking this issue. While it is likely not a "huge" issue, using node-fetch@2.6.1 from September of 2020 seems like a potential issue and one that should be addressed by the Slice-Machine team.
Thanks for letting us know; as you know, Slice Machine is an open source project, so feel free to raise an issue on the Project page as well as PR if you would like to contribute.
On my side, I will check with Slice Machine team if there is a solution for this, but before all, can you please confirm that using the latest version of node-fetch still doesn't work?
Sure thing. Using latest version 3 of node-fetch. It's in their docs that if this is an issue, then just use the latest of version 2. I didn't know this at the time.