small medium large xlarge

Generic-user-small
19 Apr 2017, 21:27
Mark Fowler (14 posts)

I’m stuck at the point of confirming the Webpack config (note that the project runs from a LAN server, not my Mac, so I start Rails with -b 0.0.0.0 and webpack-dev-server with --host 0.0.0.0).

Rather than the console message “Hello…” I’m getting an error: GET http://0.0.0.0:8080/application.js net::ERR_CONNECTION_REFUSED.

The pack_tag expands as: <script src="http://0.0.0.0:8080/application.js"></script>

Any ideas?

Dmfcb_pragsmall
19 Apr 2017, 21:42
David Copeland (382 posts)

Rails assumes the bin/webpack-dev-server is running on port 8080. If it’s not available there, it won’t work.

Not sure what your setup is like, but can you arrange to open port 8080 so that your rails app can see it?

Generic-user-small
20 Apr 2017, 00:01
Mark Fowler (14 posts)

Hi David – I believe I have 8080 open to everyone:

# netstat -l --numeric-port | grep 8080

tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN

and webpack-dev-server’s output shows:

Project is running at http://0.0.0.0:8080/

Dmfcb_pragsmall
20 Apr 2017, 12:21
David Copeland (382 posts)

I’m not sure how to debug your setup. Since you are getting a connection refused message when accessing port 8080, it must be something in your configuration. All webpack is doing is opening a socket and listening. Can you run other servers on random ports and have them work? Or is there something about your setup that blocks port 8080 (or blocks all non-port-80 ports)

Generic-user-small
21 Apr 2017, 13:33
Mark Fowler (14 posts)

If I put the URL http://_my-lan-ip_:8080/application.js in the browser, it returns a big file of code that begins: /******/ (function(modules) { // webpackBootstrap. So the port is open. Maybe something to do with my Webpack setup?

When I start webpack-dev-server the output ends with:

WARNING in ./~/@angular/core/@angular/core.es5.js 5886:15-102 Critical dependency: the request of a dependency is an expression webpack: Compiled with warnings.

Generic-user-small
21 Apr 2017, 14:06
Mark Fowler (14 posts)

I got it: In application.html.erb I had to hardcode the LAN IP address in a script tag vs using the helper javascript_pack_tag which was producing … http://0.0.0.0:8080 … . I’ll find where the helper gets the IP from the config next to clean it up.

So a cross site issue I guess.

Thanks David. Now back to the fun part :)

You must be logged in to comment