尝试使用内存缓存, Node 在与客户端连接时引发 ECONNREFUSED 错误,我已经尝试更改其他端口,得到相同的结果,并且我还重新启动了计算机,禁用了防火墙和防病毒软件。可能是什么问题?
memcache = require("memcache");
client = new memcache.Client(11211, '127.0.0.1');
client.on('connect', function() {
console.log("memcache connectd"); //this will not be called
});
client.on('close', function() {
console.log("memcache closed"); //this is called!
});
client.on('timeout', function() {
console.log("memcache timeout");
});
client.on('error', function(e) {
if (e) console.log(e);
});
client.connect();
*所有都有同样的问题! memcached、mysql、couchdb,一切都会引发此错误! D:
.
控制台输出:
$ node app.js
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' }
memcache closed
最佳答案
您需要先安装memcache服务器...
关于javascript - memcache 出现 ECONNREFUSED 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21686126/