For my previous project I was using localhost:3000 and fired it up with nodemon and it worked fine every time. But after closing the server when I try to run another project on same port it keeps loading and doesn't work. There's no error message, the tab just shows a loading icon but doesn't load anything.
I've tried changing ports too but it just doesn't work. I checked if the previous project stops listening for the port by
netstat -ano | findstr :3000
and it's empty (no listening)
After running the new project it shows
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 40684
TCP [::]:3000 [::]:0 LISTENING 40684
TCP [::1]:3000 [::1]:50967 ESTABLISHED 40684
TCP [::1]:50966 [::1]:3000 TIME_WAIT 0
TCP [::1]:50967 [::1]:3000 ESTABLISHED 36008
For the old project it is
TCP 0.0.0.0:3000 0.0.0.0:0 LISTENING 28864
TCP [::]:3000 [::]:0 LISTENING 28864
TCP [::1]:3000 [::1]:51039 TIME_WAIT 0
TCP [::1]:3000 [::1]:51040 TIME_WAIT 0
TCP [::1]:3000 [::1]:51041 TIME_WAIT 0
Turns out this is not a node problem as I downgraded from 18.9 to LTS 16.17 and the problem remains. The problem is with localhost. Local host is failing when I'm pinging it
ping 127.0.0
Pinging 127.0.0.0 with 32 bytes of data:
General failure.
General failure.
General failure.
General failure.
Ping statistics for 127.0.0.0:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
Solutions I've tried to fix this problem:
netsh int ip reset c:\tcp.txt
Resetting Compartment Forwarding, OK!
Resetting Compartment, OK!
Resetting Control Protocol, OK!
Resetting Echo Sequence Request, OK!
Resetting Global, OK!
Resetting Interface, OK!
Resetting Anycast Address, OK!
Resetting Multicast Address, OK!
Resetting Unicast Address, OK!
Resetting Neighbor, OK!
Resetting Path, OK!
Resetting Potential, OK!
Resetting Prefix Policy, OK!
Resetting Proxy Neighbor, OK!
Resetting Route, OK!
Resetting Site Prefix, OK!
Resetting Subinterface, OK!
Resetting Wakeup Pattern, OK!
Resetting Resolve Neighbor, OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , failed.
Access is denied.
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Restart the computer to complete this action.
It just fails and access is denied. To solve this I opened regedit and went to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nsi\{eb004a00-9b1a-11d4-9123-0050047759bc}
and granted permission for full control for everyone in the subfolder named '26'.
Tried to reset the TCP/IP stack back to defaults again
netsh int ip reset c:\tcp.txt
Resetting Compartment Forwarding, OK!
Resetting Compartment, OK!
Resetting Control Protocol, OK!
Resetting Echo Sequence Request, OK!
Resetting Global, OK!
Resetting Interface, OK!
Resetting Anycast Address, OK!
Resetting Multicast Address, OK!
Resetting Unicast Address, OK!
Resetting Neighbor, OK!
Resetting Path, OK!
Resetting Potential, OK!
Resetting Prefix Policy, OK!
Resetting Proxy Neighbor, OK!
Resetting Route, OK!
Resetting Site Prefix, OK!
Resetting Subinterface, OK!
Resetting Wakeup Pattern, OK!
Resetting Resolve Neighbor, OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Resetting , OK!
Restart the computer to complete this action.
And this also did not resolve the issue.
ipconfig /release
ipconfig /renew
ipconfig /flushdns
But powershell doesn't recognize it as an external or internal command so I checked for system32 in environment variable path and it was there so I checked for IPConfig.exe in system directory and it's there. Running these commands with cmd gives Media disconnected error message which I tried to solve by Resetting WINSOCK, Checking if the Network adapter is enabled, Disabling Sharing of Network and none of it worked.
Here's my package.json for new project
{
"type": "module",
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.18.1"
}
}
Here's my app.js for new project
import express, { application } from "express";
application.get("", (req, res) => {
res.send("Test");
});
application.listen(3000, () => {
console.log("Server is up on port 3000");
});
At your solution number 4, you wrote:
ipconfig/release
ipconfig/renew
ipconfig /flushdns
“But powershell doesn't recognize it as an external or internal command”
I have a “Wi-Fi doesn't have a valid IP configuration” problem, and attempted the three ipconfig commands above.
Well, I discovered the hard way that there has to be a space character separating the ipconfig command and the '/' parameter. Should be:
ipconfig /release
ipconfig /renew
ipconfig /flushdns
I hope this helps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.