Next.js Discord

Discord Forum

"npm run dev" not working even after reinstalling node

Answered
Mucuchies posted this in #help-forum
Open in Discord
MucuchiesOP
It's showing the error

class NextRequest extends Request {
                          ^
ReferenceError: Request is not defined
.
.
.
Node.js v17.7.2


Im on node 20.9.0 LTS version
Answered by Mucuchies
well well well
I used
npm i node@lts
in my project folder, now it works 😭
View full answer

37 Replies

how come your message shows v17 when you claim v20? do you have 2 installations of node?
MucuchiesOP
When I do node -v
It shows 20.9.0
are using nvm or something like this?
somehow your npm is using diferent version of node, but idk
MucuchiesOP
Not using nvm
It's frustrating
@Mucuchies can you run npx next info so we can see more info
MucuchiesOP
Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 10 Pro
Binaries:
  Node: 17.7.2
  npm: N/A
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 14.0.1
  eslint-config-next: N/A
  react: 18.2.0
  react-dom: 18.2.0
  typescript: N/A
Next.js Config:
  output: N/A


warn  - Failed to fetch latest canary version. (Reason: fetch is not defined.)
      Detected "14.0.1". Visit https://github.com/vercel/next.js/releases.
      Make sure to try the latest canary version (eg.: `npm install next@canary`) to confirm the issue still exists before creating a new issue.   
      Read more - https://nextjs.org/docs/messages/opening-an-issue



why it showing node -v 17.7.2😭
yeah that is breaking lots in that command
MucuchiesOP
i reinstalled node but still
have you tried force uninstalling node + npm (maybe nodemodules too) and trying again
MucuchiesOP
woah i dont like to use force
not really force, just go to control panel and remove
MucuchiesOP
yes i did taht
i uninstalled it completely
and same result 😭
and restarted computer :thinq:
MucuchiesOP
yesss
ok, i have no idea nowww
MucuchiesOP
restarted after deleting, restarted after installing
somehow your npm has its own feelings
MucuchiesOP
I would like to talk to next CEO
im not sure if nextjs is the issue here... i kinda think npm is choosing wrong
MucuchiesOP
ok npm CEO it is
i don't have his contact :/
MucuchiesOP
well well well
I used
npm i node@lts
in my project folder, now it works 😭
Answer
uhhh nice ig
but...
thats a little sketch
MucuchiesOP
why sketch
you shouldn't need to use npm to do that
MucuchiesOP
hmm
like i see why it works... but i also don't like it... so use it, but i still think its a little sus
MucuchiesOP
well thanks for helping
ill mark it as solved as you fixed your issue, but happy to hear a better anwer too