使用Node.js尝试获取以下网页的html内容时:
eternagame.wikia.com/wiki/EteRNA_Dictionary
我收到以下错误:
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Run Code Online (Sandbox Code Playgroud)
我确实已经在stackoverflow上查找了这个错误,并意识到这是因为node.js无法从DNS中找到服务器(我认为).但是,我不确定为什么会这样,因为我的代码完美无缺www.google.com.
这是我的代码(几乎从一个非常相似的问题复制和粘贴,除了更改主机):
var http = require("http");
var options = {
host: 'eternagame.wikia.com/wiki/EteRNA_Dictionary'
};
http.get(options, function (http_res) {
// initialize the container for our data
var data = "";
// this event fires many times, each time collecting another piece of the response
http_res.on("data", function (chunk) {
// append this chunk to our growing `data` var
data …Run Code Online (Sandbox Code Playgroud) 我想用5000而不是4200 ..
我试过的是我在根名称上创建了一个文件,ember-cli并根据下面的代码放置了JSON:
{
"port": 5000
}
Run Code Online (Sandbox Code Playgroud)
但我的应用程序仍然运行4200而不是5000
开发目的我想使用自定义域而不是启动我的 Angular 应用程序localhost
还有其他办法吗?
我能够找到php的解决方案,但没有找到Angular 应用程序的解决方案。