Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sveltekit throwing `ReferenceError: Request is not defined`

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.

like image 373
Emac342007 Avatar asked Jul 14 '26 00:07

Emac342007


1 Answers

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.

like image 69
Emac342007 Avatar answered Jul 22 '26 00:07

Emac342007