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.
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.
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:
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'
},
}
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With