Can anyone solve this problem? I'm a node.js and redis beginner.
The function createClient()
can take 2 arguments: port and host. But I'm still stuck with this problem.
var client = redis.createClient();
client.on('connect', function(){
console.log('Redis client connected');
});
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 C:\Users\my-pc\Desktop\FINAL>node index events.js:187 throw er; // Unhandled 'error' event ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1128:14) Emitted 'error' event on RedisClient instance at: at RedisClient.on_error (C:\Users\my-pc\Desktop\FINAL\node_modules\redis\index.js:406:14) at Socket. (C:\Users\my-pc\Desktop\FINAL\node_modules\redis\index.js:279:14) at Socket.emit (events.js:210:5) at emitErrorNT (internal/streams/destroy.js:92:8) at emitErrorAndCloseNT (internal/streams/destroy.js:60:3) at processTicksAndRejections (internal/process/task_queues.js:80:21) { errno: 'ECONNREFUSED',
code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1',
port: 6379 }