Next.js Discord

Discord Forum

Cannot load local development in my browser, localhost:3001

Unanswered
Goldstripe sardinella posted this in #help-forum
Open in Discord
Goldstripe sardinellaOP
I created a new Next.js project. When I run npm run dev and navigate to localhost:3001 (it's 3001 because I have another server running for something else), the webpage simply doesn't load at all! However, for some reason, when I access http://192.168.8.103:3001/ on my mobile using the same Wi-Fi, it works! I even flushed the DNS, restarted my router, unplugged the Ethernet cable, restarted the PC, and deleted all cookies in the browser & tried to use other browsers and i even turned off the firewal on windows

Also, other Next.js or Vite projects that I have are facing the same problem. This issue started occurring yesterday after I set my PC to update and shut down after I finished working.

Thanks,
David

63 Replies

Goldstripe sardinellaOP
Also, here is my hosts file in the system32/drivers/etc

# Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#    127.0.0.1       localhost
#    ::1             localhost
American Chinchilla
Have you tried deleting .next folder and restarting the server?
Goldstripe sardinellaOP
sorry, i forgot to mention, i also did that
i tried different ports as well, on different projects too, the websites just never happen to load. The initial get request is just pending there and is showing status 200 === ok
I also made sure that my vpn is turned off. Whats really weird is that it works just fine on my phone, but as you know, you cant open inspect element there so developing this way is very inconvenient for me
@Goldstripe sardinella sorry, i forgot to mention, i also did that
American Chinchilla
What did you change
Before it worked
Was it just the port?
You mentioned pc update
My other guess is trying a different lower node version
Or reinstalling node.
Goldstripe sardinellaOP
I tried downgrading and reinstalling several times all the way to node -v 18.20.5, unfortunately it does not seem to work.

I'm running out of ideas i really dont want to do anything like factory resetting my pc, i also thought about reinstalling vs code but the issue still persist even if i use command prompt from windows as a terminal so i'm not sure how that would help
Only local server that works for me is when i start a vanilla html - css - js local server on the url:
http://127.0.0.1:5500/
American Chinchilla
Hmm yeah thats tough
Is it possible to downgrade the pc version to how it was prevoously?
@American Chinchilla https://stackoverflow.com/questions/33524826/localhost-not-working-in-chrome-127-0-0-1-does-work
Goldstripe sardinellaOP
i already tried what people suggested in that post
American Chinchilla
Hmm yeah im sorry I have no idea especially since it windows
Can always try a tech store
Like IT
Goldstripe sardinellaOP
I'll try to uninstall these updates, incase it doesnt work do you know some other place where i could reach out to because this doesnt seem like next js issue as this happens when i use vite as well
When a port doesnt work this should also apply to any other with frameworks
Can you check if nothing is using the port?
Goldstripe sardinellaOP
nothing uses it
Do you think that migrating to Deno could solve the issue ?
Or its probably still the same thing since it a port issue
American Chinchilla
Sorry im not sure, this is out of my scope of skills
Goldstripe sardinellaOP
using deno also doesnt work... Thanks for help though
Goldstripe sardinellaOP
I got it to work after downgrading the windows version

(updating the windows was what probably caused the issue too but facing issues like that very often just shows me it's time to get a macbook or switch to linux)
@Luis Windows? what npm package is that? Lol
Goldstripe sardinellaOP
I was about to go off🤣🤣

Thanks for saving my time
Btw you have Windows, do you get 95-97% of ram used when you run any Next.js project locally?
Goldstripe sardinellaOP
Lemme see
Happens a lot when I start a dev server with VS Code with Next.js and Astro lately 😦
Goldstripe sardinellaOP
and node is taking up about
What are your specs
I have ryzen 5 5600 and 16gb ddr4 ram
Laptop Legion
AMD Ryzen 5 7640HS
16 RAM DDR5
Nvidia RTX 4060
M.2 4gen 1tb 7000mb/s

That’s exactly why I don’t get it
But it always happens with VSCode after a while of being working with it and having the Local server up
Goldstripe sardinellaOP
are you sure its the development server that's taking up all the memory
also what kind of development server is it, sometimes running everything locally can be very cpu intensive but this shouldnt be happening with a single page app made in next js / astro
Well it only happens when I’m running it locally, I haven’t looked up into it tbh.

Just “pnpm dev” lol the standard local server
Maybe it’s windows always having performance issues 😭
Goldstripe sardinellaOP
its a bloatware im not going lie to you
but still
open task manager
and show me what's taking up most of the cpu resources
memory too
also does this happen with new projects too ?
@Goldstripe sardinella also does this happen with new projects too ?
Most of my projects are fairly new and small so yea, but not every time.
And only after a couple hours (yes I restart the server multiple)
I have my terminal telling me my RAM usage lol that's how i know most of the times
Rn it isn't bad
Goldstripe sardinellaOP
that's normal
Maybe when you have a lot of tabs open you get the issue
Which browser are you using?
Btw dont worry when it's maxed out as long as your laptop is not overheating youre fine
@Goldstripe sardinella Which browser are you using?
Chrome
And yeah my laptop isn’t forcing at all