webpack error — sockjs-node connection refused

This is very generic error. Hence, it could be hap­pen­ing due to vari­ety of rea­sons. In my expe­ri­ence, it hap­pens mainly where there is some­thing wrong in your con­fig files. Let’s try the fol­low­ing solu­tions. Hope­fully, one of them will solve your issue.

Solu­tion 1

If your web­site is http only, then make sure you are using http pro­to­col every­where in the config.

In my case, I had https:// instead of http://

Solu­tion 2

If you are run­ning on remote machine, then change the entry point in webpack.config.js




'webpack-dev-server/client?http://' + require("os").hostname() + ':8080/',

To be more spe­cific, you can try the following :

npm install ip --save-dev 

'webpack-dev-server/client?http://' + require("ip").address() + ':8080/',

You may also like...