webpack error – sockjs-node connection refused

This is very generic error. Hence, it could be happening due to variety of reasons. In my experience, it happens mainly where there is something wrong in your config files. Let’s try the following solutions. Hopefully, one of them will solve your issue.

Solution 1

If your website is http only, then make sure you are using http protocol everywhere in the config.

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

Solution 2

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

FROM

'webpack-dev-server/client?http://localhost:8080/',

TO

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

To be more specific, you can try the following :

npm install ip --save-dev 

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


You may also like...