Sveltekit throwing `ReferenceError: Request is not defined`

1.1k views Asked by At

I just created a new sveltekit app, installed flowbite component library and flowbite-svelte-icons and started writing some code, but when I checked my app on localhost: 5173 all I saw was this message:

ReferenceError: Request is not defined
    at getRequest (file:///home/emmy/Documents/dev/public/water_watch/frontend/water_watch/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/exports/node/index.js:101:2)
    at file:///home/emmy/Documents/dev/public/water_watch/frontend/water_watch/node_modules/.pnpm/@[email protected]_@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:475:27
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

The really weird thing is that I don't even see It on my terminal, it's only on the browser.

I didn't understand it so I removed all the code I wrote until it was only the default content when the project was created but I still get the same error message.

1

There are 1 answers

4
Emac342007 On

Okay, my problem seems to be the node version I am using, because although I setup the project with node 18, my machine (for some reason) switched to node 18. The conflicting node versions is probably the reason sveltekit was acting up, because now I've changed it and it all works fine.