最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - webpack error — sockjs-node connection refused - Stack Overflow

programmeradmin1浏览0评论

I get this error when I upload my site to my webserver:

http://desktop-gq7oerj:3000/sockjs-node/info?t=1489850537555 net::ERR_CONNECTION_REFUSED

my webpack config is:

 entry: [
    'webpack-dev-server/client?http://' + require("os").hostname() + ':3000/',
    'webpack/hot/only-dev-server',
    './src/index'
],

How can I fix it?

I get this error when I upload my site to my webserver:

http://desktop-gq7oerj:3000/sockjs-node/info?t=1489850537555 net::ERR_CONNECTION_REFUSED

my webpack config is:

 entry: [
    'webpack-dev-server/client?http://' + require("os").hostname() + ':3000/',
    'webpack/hot/only-dev-server',
    './src/index'
],

How can I fix it?

Share Improve this question asked Mar 18, 2017 at 15:25 BomberBomber 11k27 gold badges97 silver badges175 bronze badges 4
  • Is your server listening on port 3000? – Matt Commented Apr 4, 2017 at 0:22
  • Thanks for your reply. Is there a way I can find out? As the error is ing from my dev server, do I even need it running in production? – Bomber Commented May 16, 2017 at 15:08
  • You say you're uploading it to your webserver? Webpack-dev-server is not for production use. What you should do is use webpack to build production code and upload those. You then setup a node/nginx server to serve the static files. – uLan Commented Aug 4, 2017 at 10:14
  • If you use docker check my answer here stackoverflow./a/65523561/4248573 it may be related – Alexey Muravyov Commented Dec 31, 2020 at 16:59
Add a ment  | 

2 Answers 2

Reset to default 1

In my case,it worked this => Here's a link

in webpack.config i aggregated :

devServer: {
      socket: 'socket',
      ...
    },

Try this

entry: production
        ? './src/index'
        : [
            `webpack-dev-server/client?http://0.0.0.0:${SETTINGS.PORT}`,
            'webpack/hot/only-dev-server',
            './src/index',
        ],
发布评论

评论列表(0)

  1. 暂无评论