Dean Chalk
Dean Chalk

Reputation: 20471

Webpack dev server - having to change port every time I run it

I'm new to webpack-dev-server, and Im using it as part of test project in React.

When I start the server first time, it works as expected. (I use an npm script to run it up via webpack.config.js)

In the Mac terminal window, when I want to close the server I use CTRL-Z and the server seems to terminate.

If I then run the server again I get

Error: listen EADDRINUSE 127.0.0.1:5001 ........

So the server didnt terminate it seems. So in order to run it up again, I have to choose a different port in webpack.config.js.

Then if I kill it and start again, I need to change ports again (and again, and again etc) - its bonkers.

Clearly I must be doing something stupid - can anyone help me out ?

Thanks

Upvotes: 2

Views: 1255

Answers (1)

topheman
topheman

Reputation: 7912

Instead of ctrl-Z, use ctrl-C to kill the process in your terminal.

Upvotes: 2

Related Questions