If I run a server with the port 80, and I try to use xmlHTTPrequest i get this error: Error: listen EADDRINUSE
Why is it problem for nodejs, if I want t
There is a way to terminate the process using Task Manager:
Note that this solution is for Windows only
Go to the Task Manager (or using the shortcut Ctrl + Shift + Esc)
On "Background Processes", find "Node.js" processes and terminate them (Right-click them and choose "End Task")
This error comes when you have any process running on a port on which you want to run your application.
how to get which process running on that port=> command: sudo netstat -ap | grep :3000
output : you will get the process information which is using that port
tcp 0 0 IPaddress:3000 : LISTEN 26869/node
Now you can kill that process sudo kill -9 26869
I have seen this error before (in node) with http.client, and as I recall, the problem had to do with not initializing the httpClient or setting bad options in the httpClient creation and/or in the url request.
Error reason: You are trying to use the busy
port number
Two possible solutions for Windows/Mac
Windows
1. netstat -ano | findstr :4200
2. taskkill /PID 5824 /F
Mac
You can try netstat
netstat -vanp tcp | grep 3000
For OSX El Capitan and newer (or if your netstat doesn't support -p), use lsof
sudo lsof -i tcp:3000
if this does not resolve your problem, Mac
users can refer to complete discussion about this issue Find (and kill) process locking port 3000 on Mac
Windows
set PORT=5000
Mac
export PORT=5000
In my case I use a web hosting but it´s the same in local host, I used:
ps -aef | grep 'node'
for watch the node process then, the console shows the process with PID. for kill the process you have to use this command:
kill -9 PID
where PID is the process id from the command above.
Another thing that can give this error, is two HTTP servers in the same node code. I was updating some Express 2 to Express 3 code, and had this...
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
// tons of shit.
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
And, it triggered this error.