Hello,
After removing the redis package from my Node project and then re-adding it, I haven't been able to import createClient. I keep getting the error: Module '"redis"' has no exported member 'createClient'. Did you mean to use 'import createClient from "redis"' instead?
I was originally on version 4.6.6 and am now on the latest, and am experiencing this error. Additionally, I have also tried downgrading back to version 4.6.6 and still experienced the same error.
Below is my code:
import {createClient} from "redis"
const config = JSON.parse(process.env.CONFIG || "{}")
const client: any = createClient({
socket: {
host: config.redis.host as string,
port: config.redis.port as number,
},
username: config.redis.username as string || undefined,
password: config.redis.password as string || undefined,
database: config.redis.db as number
})
client.connect()
client.on("error", (err: any) => console.warn(`[Vixlatio/Backend-Services/Redis] ${err}`))
client.on("connect", () => console.info("[Vixlatio/Backend-Services/Redis] Client connected"))
export default client