I am using Node v18.12.1 and vite v3.0.4. Here is my proxy code to connect to the Node.js REST API from the Vue.js vite development server:
proxy: { "/api": { target: "http://localhost:3000", changeOrigin: true, } }
After updating my node version from v16, I now receive this error from vite-proxy:
[vite] http proxy error: Error: connect ECONNREFUSED ::1:3000 at TCPConnectWrap.afterConnect [as oncomplete] (node:net:1300:16) (x3)
I heard that starting from sine v17, Node supports ipv6 as localhost. How can I solve this problem?
P粉8073979732023-11-08 10:39:19
You can run the service you are trying to connect to on ::1
or configure the proxy target to use an IPv4 address (http://127.0.0.1:3000
code> ).