After a refactor, on a separate branch, fetch no longer works in any branch. Everything else works as expected. Error:
...server/KE/utils.ts:44
const response = await fetch(
^
ReferenceError: fetch is not defined
Refactor was moving logic from KE/router.ts to a function in KE/utils.ts.
fetch is present in lib.dom.d.ts.
Had a friend a friend run the code and they were able to call fetch without issue.
Import fetch from 'node-fetch'
. Stopped compiling because as it messed with express's data types.curl -qL https://www.npmjs.com/install.sh | sudo sh
Back-end runs on Node. Update node to a version >= 18.0.0 to fix. Source.
To install latest node with nvm:
nvm install node
Credit: @Mike'Pomax'Kamermans