我写了一些代码使用模块cheerio,请求和longjohn昨天工作,但今天它总是抛出“ECONNREFUSED”错误。nodejs请求 - 总是返回econnresed
我尝试使用,使用简单的示例代码的请求:
var request = require('request');
request('http://www.google.com', function (error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body) // Show the HTML for the Google homepage.
}
else{
console.log(error);
}
})
然而,它仍然返回:
{[Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' }
只是想知道这可能是这个原因,我可以连接到互联网罚款使用网络浏览器。
感谢
可能是防火墙设置。 –
感谢AMIR,我忘记了上次我运行此代码时我有一个代理(由于使用公司互联网,对开发人员有效) – ruby