node.js – Express.js-为什么是Localhost’::’

任何人都可以告诉我为什么我的服务器地址(主机)是::而不是localhost

var express = require('express');
var app = express();

// respond with "hello world" when a GET request is made to the homepage
app.get('/',function(req,res) {
  res.send('hello world');
});

var server = app.listen(3000,function () {
  var host = server.address().address;
  var port = server.address().port;
  console.log('Example app listening at http://%s:%s',host,port);
});

这回来了

Example app listening at http://:::3000

我去http://localhost:3000/时工作正常

解决方法

因为::在使用IPv6时是localhost,就像IPv4中的127.0.0.1一样.

相关文章

这篇文章主要介绍“基于nodejs的ssh2怎么实现自动化部署”的...
本文小编为大家详细介绍“nodejs怎么实现目录不存在自动创建...
这篇“如何把nodejs数据传到前端”文章的知识点大部分人都不...
本文小编为大家详细介绍“nodejs如何实现定时删除文件”,内...
这篇文章主要讲解了“nodejs安装模块卡住不动怎么解决”,文...
今天小编给大家分享一下如何检测nodejs有没有安装成功的相关...