Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why am I getting ERR_CONNECTION_TIMED_OUT in Vue.js?

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

like image 675
g miou Avatar asked Sep 30 '18 18:09

g miou


2 Answers

Create vue.config.js with the following code:

module.exports = { devServer: {      host: 'localhost'     } }; 

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

like image 120
Alexey Ryazhskikh Avatar answered Sep 19 '22 13:09

Alexey Ryazhskikh


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'   } } 
like image 45
Eric Bynum Avatar answered Sep 20 '22 13:09

Eric Bynum