Nuxt.js: Cannot run npm start if UNIX socket file already exists from previous run

Created on 19 Mar 2019  路  3Comments  路  Source: nuxt/nuxt.js

Version

v2.4.5

Reproduction link

https://codepen.io/anon/pen/wOxYjR

Steps to reproduce

1) In nuxt.config.js set server: {socket: 'nuxt.js'} (according to docs)
2) npm run build
3) npm start
4) kill process (Ctrl+C)
5) npm start

What is expected ?

Nuxt will connect to the existing .socket file or replace it with a new one

What is actually happening?

Second npm start will fail with Nuxt Fatal Error "Error: Address localhost:3000 is already in use." - the error message does not help much because the origin of the error is existing socket file, not the running instance

Additional comments?

I could remove the socket as part of start script, however I do not find such a solution clean plus I believe that the error message should be more helpful

This bug report is available on Nuxt community (#c8864)
bug-report

Most helpful comment

Hi,

We would really like cleanup of the unix socket file (and a method for chmod 777 as well if needed). Anything that can be done about it?

Referring to this: https://stackoverflow.com/questions/16178239/gracefully-shutdown-unix-socket-server-on-nodejs-running-under-forever

It should be possible in any case and we have other nodejs running where we never see issues when using the socket file :)

All 3 comments

@OndraRehounek Thanks for the reporting 馃槃

I corrected the error message in https://github.com/nuxt/nuxt.js/commit/2eb196535701403d44973bbc252e441042466fca , but we couldn't simply remove the socket file since we don't know if is using by any other server, so a helpful message should be proper, hope you can understand 馃樃 .

@clarkdo that makes sense :) thanks for such a fast reply!

Hi,

We would really like cleanup of the unix socket file (and a method for chmod 777 as well if needed). Anything that can be done about it?

Referring to this: https://stackoverflow.com/questions/16178239/gracefully-shutdown-unix-socket-server-on-nodejs-running-under-forever

It should be possible in any case and we have other nodejs running where we never see issues when using the socket file :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bimohxh picture bimohxh  路  3Comments

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments

surmon-china picture surmon-china  路  3Comments

mikekidder picture mikekidder  路  3Comments