【发布时间】:2022-11-19 15:30:14
【问题描述】:
使用 client.set('hi', 'there') 时,我得到的是 Uncaught ClientClosedError: The client is closed redis ,所以我不得不使用:
client.connect()
它起作用了,但后来我得到了一个未解决的承诺,所以我不得不使用await:
await client.set('hi', 'there')
然后它起作用了,但是现在当我使用client.hset('german', 'red', 'rot') 时,我得到:
Uncaught TypeError: client.hset is not a function
我遵循的教程在使用 client.set('hi', 'there') 时没有提到使用 client.connect() 和 await
不确定我是否安装了错误版本的 Redis。我使用 yarn 安装它,因为我在使用 npm 时遇到问题。
【问题讨论】:
标签: javascript node.js redis node-redis