本文介绍了无法将请求/pusher/auth 从 localhost:3000 代理到 http://localhost:5000 (ECONNREFUSED)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 reactJS 和 pusher 创建一个聊天应用程序,我收到此错误-

I am trying to create a chat app using reactJS and pusher, i am getting this error-

无法将请求/pusher/auth 从 localhost:3000 代理到http://localhost:5000 (ECONNREFUSED)

在 package.json 文件中,我将代理设置为-

in package.json file i have set proxy as-

"proxy": "http://localhost:5000"

和我的 localhost/etc/hosts 文件中被定义为 127.0.0.1.
我还使用 netstat 检查了端口可用性,但这些似乎都是正确的.有人可以帮忙吗?

and my localhost is defined as 127.0.0.1 in /etc/hosts file.
I have also checked for the port availability using netstat, but these all seems to be correct. Can anybody help?

推荐答案

我在 React 应用程序中遇到了同样的问题,我通过在 package.json 文件中的端口号后添加/"来修复它(所以现在它是:"proxy": "http://localhost:5000/")

I had a same problem in my React App and I fixed it by just adding "/" after the port number in package.json file (so now it's: "proxy": "http://localhost:5000/")

这篇关于无法将请求/pusher/auth 从 localhost:3000 代理到 http://localhost:5000 (ECONNREFUSED)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 17:48