错误:connect econnrefuse127.0.0.1:6379

qjp7pelc  于 2021-06-09  发布在  Redis
关注(0)|答案(0)|浏览(615)

我有这样的代码

const redis = require("redis");
const client = redis.createClient();

client.on("connect", function() {
  console.log("You are now connected");
});

client.set("student", "Laylaa", function(err, reply) {
  console.log(reply);
});

但是有这样一个错误。。
events.js:291抛出器;//未处理的“错误”事件^
错误:tcpconnectwrap.afterconnect[as oncomplete](net.js:1145:16)处的connect econnrefused 127.0.0.1:6379在redisclient.on处的redisclient示例上发出“error”事件\u socket处的错误(e:\teknik informatika\latihan redis\node\modules\redis\index.js:341:14)(e:\teknik informatika\latihan redis\node\u modules\redis\index.js:222:14)
在socket.emit(events.js:314:20)在emiterrornt(internal/streams/destroy.js:106:8)在emiterrorclosent(internal/streams/destroy.js:74:3)在processticksandrejections(internal/process/task\u queues.js:80:21){errno:-4078,code:'econnrefused',syscall:'connect',address:'127.0.0.1',port:6379}
有解决办法吗?谢谢

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题