Vue: 404 connection refused errors in browser console

An issue I had recently was where I was seeing numerous errors in my browser console, that looked like this:

http://localhost:4000/sockjs-node/info?t=1555523570042 net::ERR_CONNECTION_REFUSED

If you’re seeing errors like these in your browser console, you’re probably running your Vue app using vue-cli-service which is a part of vue-cli. This is the development server basically, which serves your Vue app.

What you need to do to get rid of the errors, is you need to specify a port in your webpack config file. The webpack config file is located at vue.config.js in your project folder.

This is what I have in my vue.config.js file:

module.exports = {
    devServer: {
        disableHostCheck: true,
        host: '0.0.0.0',
        port: 4000
    }
}
Posted in: Vue

Leave a Reply

Your email address will not be published. Required fields are marked *