Why am I getting ERR_CONNECTION_TIMED_OUT in Vue.js?
Asked Answered
A

2

30

After creating a new project with vue cli 3 I get this error:

GET http://192.168.1.13:8080/sockjs-node/info?t=1538257166715 net::ERR_CONNECTION_TIMED_OUT sockjs.js?9be2:1605

Operation system: Windows 10

Arcature answered 30/9, 2018 at 18:58 Comment(3)
is this the localhost url you get when you run npm run serve?Jagannath
I get localhot:8080 ,also when i run my app in Linux Mint i don't get these error .Arcature
In my case it was switching between wifi networks. I started getting such errors once I switched to another wifi network while running dev server on old wifi network. I just restarted dev server to align with new network configuration and the issue gone.Delanie
A
45

Create vue.config.js with the following code:

module.exports = {
devServer: {

    host: 'localhost'
    }
};

https://cli.vuejs.org/config/#devserver

Aerobic answered 5/12, 2018 at 11:26 Comment(0)
P
8

To expand on Alexey's answer...

If your frontend app and the backend API server are not running on the same host, you will need to proxy API requests to the API server during development. This is configurable via the devServer.proxy option in vue.config.js. https://cli.vuejs.org/config/#devserver

module.exports = {
  devServer: {
    proxy: 'http://localhost:8080'
  }
}
Pandarus answered 21/3, 2020 at 17:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.