Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Serving webpack dev server from a specific IP address

I'm trying to switch from localhost to a specific IP address, but I keep getting this error:

listen EADDRNOTAVAIL 192.168.1.139:8000

webpack.config.js

devServer: {
    host: '192.168.1.139',
    port: '8000',
    compress: true,
}
like image 344
yacine benzmane Avatar asked May 07 '26 12:05

yacine benzmane


2 Answers

The error you encountered:

listen EADDRNOTAVAIL 192.168.1.139:8000

Throws due to binding to already used port, it means 8000 is currently being managed eg. from another application (You must change a port or you must kill a process).

For your case of making local IP address binded as host it is possible for example via npm/yarn start:

"start": "webpack-dev-server --inline --port 8080 --host 192.168.1.139 --content-base ."

Assuming your machine's local IP is 192.168.1.139.

Based on Snippet from issue #147 webpack-dev-server.

like image 197
Xarvalus Avatar answered May 10 '26 02:05

Xarvalus


As you are trying to map to a differrent ip : You need an entry in your hosts file as well to point that to localhost. add the below in to your hosts file

127.0.0.1 192.168.1.139

like image 24
rEjITh Avatar answered May 10 '26 01:05

rEjITh



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!