简体   繁体   中英

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. :(

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.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM