bradtraversy / chatcord

Realtime chat app with rooms
1.16k stars 1.15k forks source link

Error: connect ECONNREFUSED 127.0.0.1:6379 #55

Open philcoul opened 1 year ago

philcoul commented 1 year ago

Hi I unzip the files and folders in a directory and run npm install node run start The server crashed. Did I miss anything

PS D:\Programming\nodeJS\tutorial\ws\chatCord> npm run dev

chatcord@1.0.0 dev nodemon server

[nodemon] 2.0.2 [nodemon] to restart at any time, enter rs [nodemon] watching dir(s): . [nodemon] watching extensions: js,mjs,json
[nodemon] starting node server.js Server running on port 3000 node:internal/process/promises:289 triggerUncaughtException(err, true / fromPromise /);

Error: connect ECONNREFUSED 127.0.0.1:6379 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1283:16) Emitted 'error' event on Commander instance at: at RedisSocket. (D:\Programming\nodeJS\tutorial\ws\chatCord\node_modules\@node-redis\client\dist\lib\client\index.js:338:14) at RedisSocket.emit (node:events:513:28) at RedisSocket._RedisSocket_connect (D:\Programming\nodeJS\tutorial\ws\chatCord\node_modules\@node-redis\client\dist\lib\client\socket.js:119:14) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Commander.connect (D:\Programming\nodeJS\tutorial\ws\chatCord\node_modules\@node-redis\client\dist\lib\client\index.js:162:9) at async D:\Programming\nodeJS\tutorial\ws\chatCord\server.js:28:3 { errno: -4078, code: 'ECONNREFUSED', syscall: 'connect', address: '127.0.0.1', port: 6379 }

Node.js v19.2.0 [nodemon] app crashed - waiting for file changes before starting...

ghost commented 1 year ago

Same thing happened with me

philcoul commented 1 year ago

Hi, I noticed that in the last version of the server.js from brad had the 'redis' package and much more. To get rid of this I used the code from 01Leviathan10 and it worked. Just need to update the package.json with the latest versions of packages like below and you are all set. https://github.com/bradtraversy/chatcord/network/members

"dependencies": { "express": "^4.18.2", "moment": "^2.29.4", "socket.io": "^4.5.4"

bhaktitud commented 1 year ago

hey you need to install docker, just add a file called docker-compose.yml in the root of your project

and add the snippet bellow inside the file

version: "3"

services:
  redis:
    image: redis:5
    ports:
      - "6379:6379"

make sure your docker desktop is up and running,

now run this command in your terminal

docker-compose up -d

and finally run the server

npm run dev
danielmeyer-hash commented 10 months ago

i still have the same problem i dont know what to do

ragnarbull commented 9 months ago

@bhaktitud I made a PR to fix Redis see: #61

@danielmeyer-hash if you follow the comment above you it works perfectly. Or clone the project with my PR and setup Docker desktop and it will work.