1

when i execute the program with npm start, appears:

Error: bind EADDRINUSE null:80
    at Object.exports._errnoException (util.js:896:11)
    at exports._exceptionWithHostPort (util.js:919:20)
    at cb (net.js:1311:16)
    at rr (cluster.js:620:14)
    at Worker.<anonymous> (cluster.js:590:9)
    at process.<anonymous> (cluster.js:750:8)
    at emitTwo (events.js:111:20)
    at process.emit (events.js:191:7)
    at handleMessage (internal/child_process.js:718:10)
    at Pipe.channel.onread (internal/child_process.js:444:11)
CLUSTER: Worker 177 disconnected from the cluster.
CLUSTER: Worker 177 died with exit code 1 (null)
CLUSTER: Worker 181 started
events.js:160
      throw er; // Unhandled 'error' event

if change the port from 80 to 8080, the program executes, but don't conect to api.localhost:3000

1
  • 1
    info : You must be root to get the system ports (< 1024) Commented Jan 4, 2019 at 14:44

2 Answers 2

6

EADDRINUSE means "Error ADDress already IN USE"

So you probably have another process listening on the port 80

On linux, you can list ports in use with the command netstat -a | grep LISTENING | grep 80

Sign up to request clarification or add additional context in comments.

Comments

0

As a privileged user, you should be able to list processes referring to TCP port 80 using:

netstat -plant | grep LISTENING | grep :80

On the right column, you should find a process name and corresponding PID, that would indicate who's listening on that port.

Using a debian or el7 based system, nowadays, you would usually need to install the net-tools package, providing with the netstat command.

As suggested by Gregory NEUT, maybe you do not have enough privileges binding on :80. Although AFAIR, in those case, you should get an EACCESS error. Whereas EADDRESSINUSE would indicate an other application is already listening on TCP:80. It might even be a previous copy of your application, running in background.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.