EXP4001: Port is in use
Raised as an error, in every environment.
Another process is listening on the port the application was asked to listen on.
In development (NODE_ENV is development or local) the framework stops that process and takes the port, which is what you want when the previous run of the same application is still up. Anywhere else the start fails with this code, the message names the process that holds the port, and that process keeps running.
Until 4.4.0 the port was taken over in every environment, production included.
Fix
- Stop the process named in the message, or
- start on another port:
PORT=3001 npm run prod.
All codes are listed under Error responses.