Trouble Shooting

Redis 적용시 connection failed 해결방법 (node repo)

DEV_BLOG 2022. 8. 24. 19:48

 

redis를 연습해보려고 node레포에 반영해보려고 하였다.

 

npm install redis --save

npm install정도만 해도 node에서 redis 쓸 수 있나..? 하고 기대하였지만 다음과 같은 메시지들을 마주하게 되었다.

 

 

해결방법: redis 공식문서 ( https://redis.io/docs/getting-started/ ) 에서 redis를 전역으로 install을 따로 먼저 해주어야 node 프로젝트에서도 사용할 수 있다.

 

 

 

꽤 자세하게 설명되어있는 블로그도 하나 찾아두었다!

https://inpa.tistory.com/entry/REDIS-%F0%9F%93%9A-Window10-%ED%99%98%EA%B2%BD%EC%97%90-Redis-%EC%84%A4%EC%B9%98%ED%95%98%EA%B8%B0

 

[REDIS] 📚 Window10 환경에 Redis 설치 & 설정

Redis 윈도우 설치 Redis 다운로드 페이지로 이동하여 설치 프로그램을 다운로드하고 설치를 진행한다. Releases · microsoftarchive/redis Redis is an in-memory database that persists on disk. The data mo..

inpa.tistory.com

 

 

 

이후에 노드에서 redis가 적용되었는지 확인해보면 될 것이다.

const redis = require("redis");

async function run() {
  const client = redis.createClient();
  await client.connect();
  console.log(client.isOpen); // this is true
  await client.disconnect();
}
run();