> 文档中心 > 【node 报错】Cannot set headers after they are sent to the client(消息头被发送到客户端后不能设置消息头)

【node 报错】Cannot set headers after they are sent to the client(消息头被发送到客户端后不能设置消息头)


🥇 在写后端接口,进行用户注册验证时,控制台报错。报错信息:

Cannot set headers after they are sent to the client
在这里插入图片描述
用户注册验证代码如下:
在这里插入图片描述

🥇 原因分析及解决办法

在这里插入图片描述
最终将32行注释即解决问题,问题本质原因是send()冲突,导致返回客户端两个信息

🥂(❁´◡`❁)您的点赞👍➕评论📝➕收藏⭐是作者创作的最大动力🤞