问题描述

环境

$ node -v
v16.14.0# redis-cli
127.0.0.1:6379> info
# Server
redis_version:5.0.5

版本 package.json

{"dependencies": {"redis": "^4.2.0"}
}

代码

import { createClient } from 'redis'const REDIS_URL = "redis://root:123456@127.0.0.1:6379"export async function getRedisClient() {// 连接redisconst client = createClient({url: REDIS_URL,})await client.connect()return client
}

报错

node:internal/process/promises:265triggerUncaughtException(err, true /* fromPromise */);^[ErrorReply: ERR wrong number of arguments for 'auth' command]

解决办法

明明是按照格式写的,却报错了

redis[s]://[[username][:password]@][host][:port][/db-number]

按照github上的issues,如果是默认username, 那么需要省略

const REDIS_URL = "redis://:123456@127.0.0.1:6379"

参考
https://github.com/redis/node-redis/issues/1591

node-redis:ErrorReply: ERR wrong number of arguments for ‘auth‘ command相关推荐

  1. ERR wrong number of arguments for 'sadd' command

    在用spring redis 存储set数据的时候,提示了这个ERR wrong number of arguments for 'sadd' command这个错误,通过调试发现: redisTem ...

  2. ERR wrong number of arguments for ‘srem‘ command

    ERR wrong number of arguments for 'srem' command 问题描述 再远程调用redis服务得时候,出现得这个异常,字面意思就是参数不匹配 问题解决 原因是因为 ...

  3. (error) ERR wrong number of arguments for 'hmget' command

    首先不存在hmgetall这样的命令, localhost:6379> hgetall people_info "\xe5\xbc\xa0\xe5\xb0\x8f\xe4\xba\x8 ...

  4. org.springframework.dao.InvalidDataAccessApiUsageException: ERR wrong number of arguments for ‘srem‘

    1.报错信息 org.springframework.dao.InvalidDataAccessApiUsageException: ERR wrong number of arguments for ...

  5. C++工作笔记-hiredis中关于ERR wrong number of arguments for HMSET问题的解决

    这里有个坑 使用hiredis的API进行调用时如果是如下命令, hmset userid:1001 username 'xiao ming' 这种语法,使用redis-cli是没有问题的,但如果使用 ...

  6. Redis问题:ERR max number of clients reached

    redis高并发下,可能有些连接没有释放,导致连接数耗尽,会提示 ERR max number of clients reached 这个时候通过命令查看客户端使用连接数 [root@home-ser ...

  7. node安装:npm install xxx命令出现npm ERR code EPERM错误

    下载安装node和npm,执行node -v和npm -v成功, node下载:下载 | Node.js 中文网 安装教程:node.js 安装详细步骤教程_老油条-CSDN博客_node安装 但执行 ...

  8. Node.js:它是什么,何时以及如何使用它,以及为什么要使用它

    by Pablo Regen 通过帕勃罗·雷根(Pablo Regen) You've probably read these sentences before- 您可能已经读过这些句子了-- Nod ...

  9. node redis集群_如何使用集群扩展Node.js服务器

    node redis集群 by Michele Riva 由Michele Riva 如何使用集群扩展Node.js服务器 (How to scale your Node.js server usin ...

最新文章

  1. 既然他人的成功与自己无关,何必过于关注他人?
  2. 24BYJ48电机的使用,带驱动程序
  3. MySQL备份恢复工具xtrabackup
  4. Android解决依赖冲突
  5. python——成语接龙小游戏
  6. IOS 应用中从竖屏模式强制转换为横屏模式
  7. Spring通知类型及使用ProxyFactoryBean创建AOP代理
  8. b站电脑客户端_B站(哔哩哔哩) 视频批量下载工具#电脑版##更新
  9. Java 程序 ——感想
  10. android 融云sdk集成,使用融云SDK集成
  11. 动态更新 HTML 内容 —— AJAX
  12. 夸奖对方代码写的好_我写出这样干净的代码,老板直夸我
  13. sqlmap DVWA脱库
  14. 公安部督办侵犯个人信息案:银行行长卖账号
  15. ps cc 2014 智能切图
  16. python文件或目录损坏且无法读取,data\sogoupy\verify.ini已损坏且无法读取,啥意思?谢谢?...
  17. 光纤跳线结构及分类介绍
  18. 关于淘客软件的那些事儿
  19. 电脑不显示无线连接网络连接服务器,连接wifi后显示无internet访问权限怎么解决...
  20. 外观模式——透过现象看本质

热门文章

  1. Java与Infopath表单-1
  2. springboot多数据源使用
  3. 长安逸动系统升级服务器连接失败,15逸动系统救砖、升级教程
  4. 第九次ScrumMeeting博客
  5. 元素和小于等于阈值的正方形的最大边长(来源:力扣(LeetCode))
  6. 基于FPGA 的PLC/PAC 硬件运行时的实现
  7. 信息安全与网络安全有什么区别?
  8. php试题答案是非题,PHP试题带答案
  9. 一次郁闷的58同城经历
  10. 小程序开发之微信接入微信调用wenxin4j