Skip to content
Advertisement

Why does my localhost application on Node.js take so long/refuse to connect?

Why does my localhost:3000 application take so long to load? I have tried quite a lot of ways to solve this, such as:

  1. Disable IPv6
  2. Add localhost into the hosts file
  3. Update npm and node.js to the latest version

The localhost doesn’t load, and eventually, just stops loading and refuses to connect. I don’t know why this is happening. I am using Microsoft Edge and Windows 10.

Here is my code:

//jshint esversion:6
const express = require("express");
const app = express();

app.get("/", function(request, response) {
   response.send("Hello World");
});

app.listen(3000, function()
{
   console.log("Server is listening on port 3000.");
});

Any Help would be appreciated. Thanks.

Edit: It used to load at least a little bit but never fully loaded, now it just refuses to connect. 🙁

Advertisement

Answer

The command line exited the node application, but from my side, it said it was still running. It must have just been a bug. I restarted my pc and it worked.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement