javascript - memcache 出现 ECONNREFUSED 错误

标签 javascript node.js memcached

尝试使用内存缓存, 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/

相关文章:

node.js - 调试 “Visual Studio Code” 中的单个 javascript 文件

node.js - 如何在柔性环境下使用 node.js 中的 GAE Memcache

javascript - 在 javascript 中迭代一个 json 对象,在数组中有一个数组

javascript - 无法通过 ember 安装 bourbon

javascript - 条形图中每个条形的不同颜色;图表JS

node.js - 从 jade 中的 Node 渲染数据

java - 如何在GWT中从javascript获取返回类型 'any'到java? (泛型类型传递)

node.js - redis服务器键值对的值中如何存储一个数组?

基于Java的memcached客户端,优化将数据放入memcache

ruby-on-rails - 如何在heroku上使用两个不同的memcache实例