title: Error: connect ECONNREFUSED 127.0.0.1:6379
body: <p>I have coding like this</p>
  <pre><code>const redis = require(&quot;redis&quot;);
  const client = redis.createClient();
  
  client.on(&quot;connect&quot;, function() {
    console.log(&quot;You are now connected&quot;);
  });
  
  client.set(&quot;student&quot;, &quot;Laylaa&quot;, function(err, reply) {
    console.log(reply);
  });
  </code></pre>
  <p>but there is an error like this..</p>
  <p>events.js:291
  throw er; // Unhandled 'error' event
  ^</p>
  <p>Error: connect ECONNREFUSED 127.0.0.1:6379
  at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1145:16)
  Emitted 'error' event on RedisClient instance at:
  at RedisClient.on_error (E:\TEKNIK INFORMATIKA\Latihan redis\node_modules\redis\index.js:341:14)
  at Socket. (E:\TEKNIK INFORMATIKA\Latihan redis\node_modules\redis\index.js:222:14)<br />
  at Socket.emit (events.js:314:20)
  at emitErrorNT (internal/streams/destroy.js:106:8)
  at emitErrorCloseNT (internal/streams/destroy.js:74:3)
  at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  errno: -4078,
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '127.0.0.1',
  port: 6379
  }</p>
  <p>is there a solution? Thanks</p>