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

James McMahon
  • 48,506
  • 64
  • 207
  • 283
g miou
  • 365
  • 1
  • 4
  • 10
  • 1
    is this the localhost url you get when you run `npm run serve`? – Dan Oswalt Sep 30 '18 at 19:45
  • I get localhot:8080 ,also when i run my app in Linux Mint i don't get these error . – g miou Sep 30 '18 at 20:25
  • 7
    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. – Maksim Shamihulau Nov 07 '19 at 17:02

2 Answers2

45

Create vue.config.js with the following code:

module.exports = {
devServer: {

    host: 'localhost'
    }
};

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

Alexey Ryazhskikh
  • 2,458
  • 4
  • 32
  • 51
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'
  }
}
Eric Bynum
  • 471
  • 7
  • 7