ReferenceError: Request is not defined -while setting up sveltekit project

ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
at processTicksAndRejections (node:internal/process/task_queues:96:5)
I just setup a fresh sveltekit project, when I opened the localhost it shows me the error above in the browser. No error in terminal console. node version using - v20.12.1 And also while creating a Vue project I get this error. command: npm create vue@latest ouptut:
TypeError: (0 , import_node_util.parseArgs) is not a function
at init (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4481:72)
at Object.<anonymous> (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4862:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
TypeError: (0 , import_node_util.parseArgs) is not a function
at init (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4481:72)
at Object.<anonymous> (C:\Users\welcome\AppData\Local\npm-cache\_npx\2f7e7bff16d1c534\node_modules\create-vue\outfile.cjs:4862:1)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
Are these errors interlinked somehow? How to solve it?
50 Replies
theoriginalandrew
theoriginalandrewโ€ข8mo ago
Request is not defined definitely sounds like a Node version issue. I'm like 95% sure something changed in versions with node about how the Request package was built and then it was removed. You may need to use Node 18
JOY
JOYOPโ€ข8mo ago
Using 20.12.1 I reinstalled nvm But still didn't work
theoriginalandrew
theoriginalandrewโ€ข8mo ago
if you use nvm you could just install a v18 and check that, but the way Requests are used changed between 16 -> 18... so if you're on 20........................................................... i shall look more assuming your machine is on 20? is your package also on 20? they can definitely be mismatched
JOY
JOYOPโ€ข8mo ago
I tried to setup fresh project with 20.12.1 Still showing the error
theoriginalandrew
theoriginalandrewโ€ข8mo ago
when you run nvm -v in your project, what does that say?
JOY
JOYOPโ€ข8mo ago
1.1.12
theoriginalandrew
theoriginalandrewโ€ข8mo ago
:FacePalm: i definitely thought of one thing and asked a different thing
JOY
JOYOPโ€ข8mo ago
Happens
theoriginalandrew
theoriginalandrewโ€ข8mo ago
have you done like nvm use v20.12.1 in your project?
JOY
JOYOPโ€ข8mo ago
Yes sir
nvm list

* 20.12.1 (Currently using 64-bit executable)
20.11.0
nvm list

* 20.12.1 (Currently using 64-bit executable)
20.11.0
theoriginalandrew
theoriginalandrewโ€ข8mo ago
:pepeSad:
JOY
JOYOPโ€ข8mo ago
๐Ÿ˜ญwhy meeeee
theoriginalandrew
theoriginalandrewโ€ข8mo ago
not sure it is you could very well be an issue with sveltekit or vite or something else especially if its a fresh build
JOY
JOYOPโ€ข8mo ago
I mean why I'm the victim of this problem I can setup a vue project either
theoriginalandrew
theoriginalandrewโ€ข8mo ago
never happens in React >:)
JOY
JOYOPโ€ข8mo ago
Cant *
theoriginalandrew
theoriginalandrewโ€ข8mo ago
can you try downgrading node to a stable v18 version and see if that works?
JOY
JOYOPโ€ข8mo ago
okk only for u ๐Ÿ’…
ErickO
ErickOโ€ข8mo ago
are you checking node version in the same terminal as you're running the project? AKA not using the terminal for nvm list but using the vscode terminal to run the project
theoriginalandrew
theoriginalandrewโ€ข8mo ago
i googled both of the errors and both seemed to resolve on v18 so my brain says "do that" ๐Ÿ˜„ also definitely worth double checking that the versions are correct in the vsc terminal though they should match up
JOY
JOYOPโ€ข8mo ago
well i checked on every terminal yes i checked on vsc termianl already did, they match everywhere even in sys32 dir and even in project folder
แผ”ฯฯ‰ฯ‚
why are you trying to do this on windows, instead of wsl?
theoriginalandrew
theoriginalandrewโ€ข8mo ago
the real question is why not mac ๐Ÿ™‚ jk
แผ”ฯฯ‰ฯ‚
because it costs an intel and a leg not an arm, because it already has one
theoriginalandrew
theoriginalandrewโ€ข8mo ago
thats a big brain response maybe its just me but for whatever reason v20 causes issues ๐Ÿ˜ฆ
แผ”ฯฯ‰ฯ‚
i used it in a debian vm with version 21
JOY
JOYOPโ€ข8mo ago
how come it works fine on my friends system
แผ”ฯฯ‰ฯ‚
and it didnt cause any issues
JOY
JOYOPโ€ข8mo ago
im installing version 18 rn btw, 18.16.1
theoriginalandrew
theoriginalandrewโ€ข8mo ago
we actually deleted a docker image on v20 because of a severe CVE and then it was determined that CVE messed up their flag
แผ”ฯฯ‰ฯ‚
good question
ErickO
ErickOโ€ข8mo ago
have you heard of docker?
theoriginalandrew
theoriginalandrewโ€ข8mo ago
18.16.1 is my favorite ๐Ÿ˜„
JOY
JOYOPโ€ข8mo ago
yup, but dont want to get into it rn
ErickO
ErickOโ€ข8mo ago
don't get into it, the very concept of docker should be an answer for that question
theoriginalandrew
theoriginalandrewโ€ข8mo ago
besides, why do wsl when you can use the new prevew version of dev home on windows
แผ”ฯฯ‰ฯ‚
the what?
theoriginalandrew
theoriginalandrewโ€ข8mo ago
Dev Home for Windows Developers
Dev Home is a new control center for Windows providing the ability to track your workflows and coding tasks using customizable widgets, set up your dev environment, connect to your developer accounts and tools (such as GitHub), and install apps and packages all in one place.
theoriginalandrew
theoriginalandrewโ€ข8mo ago
slightly clunky but works pretty well
ErickO
ErickOโ€ข8mo ago
the definition of Windows?
theoriginalandrew
theoriginalandrewโ€ข8mo ago
true. this is not the case on either of my Macs
แผ”ฯฯ‰ฯ‚
looks kinda interesting
JOY
JOYOPโ€ข8mo ago
still same error ๐Ÿ˜ข
npm --verbose run dev
npm verb cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@9.5.1
npm info using node@v18.16.1
npm verb title npm run dev
npm verb argv "--loglevel" "verbose" "run" "dev"
npm verb logfile logs-max:10 dir:C:\Users\welcome\AppData\Local\npm-cache\_logs\2024-04-10T06_43_02_301Z-
npm verb logfile C:\Users\welcome\AppData\Local\npm-cache\_logs\2024-04-10T06_43_02_301Z-debug-0.log
npm --verbose run dev
npm verb cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
npm info using npm@9.5.1
npm info using node@v18.16.1
npm verb title npm run dev
npm verb argv "--loglevel" "verbose" "run" "dev"
npm verb logfile logs-max:10 dir:C:\Users\welcome\AppData\Local\npm-cache\_logs\2024-04-10T06_43_02_301Z-
npm verb logfile C:\Users\welcome\AppData\Local\npm-cache\_logs\2024-04-10T06_43_02_301Z-debug-0.log
its the logs
theoriginalandrew
theoriginalandrewโ€ข8mo ago
what do you mean same error? like one of the ones above?
JOY
JOYOPโ€ข8mo ago
yes sir
ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
ReferenceError: Request is not defined
at getRequest (file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/node/index.js:107:2)
at file:///C:/Users/welcome/Desktop/Ed/sveltkit-test/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:497:27
theoriginalandrew
theoriginalandrewโ€ข8mo ago
GitHub
ReferenceError: Request is not defined at getRequest (file:///....
Describe the bug After running npm run dev... this error persists in the localhost browser... site will not load. ReferenceError: Request is not defined at getRequest (file:///../node_modules/@svel...
theoriginalandrew
theoriginalandrewโ€ข8mo ago
just skip past the "steps to reproduce" section
JOY
JOYOPโ€ข8mo ago
I can understand his feelings
theoriginalandrew
theoriginalandrewโ€ข8mo ago
GitHub
ReferenceError: Request is not defined ยท vercel next.js ยท Discussio...
Summary Hi, Suddenly my code is giving this error when deploying on Vercel. I tried tons of things to fix it but nothing seems to work. When I run it locally whether with "next dev", &quo...
theoriginalandrew
theoriginalandrewโ€ข8mo ago
seems like there might be some steps in that one that could potentially solve it, but i'm not a svelte dev (just a scummy ol React dev) so i'm a bit beyond my depths when it comes to that library ๐Ÿ˜ฌ
Want results from more Discord servers?
Add your server