Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Errors in browser console, requests to /sockjs-node/info?t=1555629946494

Tags:

vue.js

vue-cli

I created a new site using vue-cli. I'm using the development server to serve the page. When I view the page in my browser, I see two types of errors show up in my browser console:

GET http://172.31.7.153:4000/sockjs-node/info?t=1555922702538 net::ERR_CONNECTION_TIMED_OUT
GET http://localhost:4000/sockjs-node/info?t=1555922708541 net::ERR_CONNECTION_REFUSED

I'm not sure what it means, or how/why it's being called, and it shows up repeatedly about every 5 seconds.

like image 859
Blaine Lafreniere Avatar asked Apr 18 '19 23:04

Blaine Lafreniere


4 Answers

I finally fixed it using the devServer.public configuration option.

Below is my vue.config.js file:

module.exports = {
    devServer: {
        disableHostCheck: true,
        port: 4000,
        public: '0.0.0.0:4000'
    },
    publicPath: "/"
}

I got my answer from reading this.

like image 117
Blaine Lafreniere Avatar answered Oct 22 '22 00:10

Blaine Lafreniere


To disable this warning just the config host: 'localhost' is needed.

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

Create this file vue.config.js if not exist at root.

Note: The disableHostCheck config is officially discouraged.

More info:

  • Vuejs Doc: DevServer
  • Webpack: devServer.disableHostCheck
  • Fix Source
like image 20
Nakamoto Avatar answered Oct 21 '22 23:10

Nakamoto


I fixed this with the following vue.config.js file:

module.exports = {
  devServer: {
    host: '0.0.0.0',
    https: false,
    port: 8080,
    public: 'http://0.0.0.0:8080'
  },
}
like image 1
HyperActive Avatar answered Oct 21 '22 22:10

HyperActive


For me this worked in vue.config.js:

module.exports = {
    devServer: {
        public: 'localhost'
    },
}

I also tried to use host like Nakamoto suggested but then the site was not loading anymore.

like image 1
Mano Meter Avatar answered Oct 22 '22 00:10

Mano Meter