those who know about node js . Can you help me . I have some error in my js code. By using postman made a code to give res, Req . I used port 5000 in my lap . But it always show me an error "5000 is already used .
i kill the port number on cmd , and i tried another port number . Bu same error
2
Answers
Based on the error that you gave im sure the problem is that you havent set the current port if you read the error it says its attempting to use port 5000 not 3000 make sure your code is correctly conifgured. If you provide some code I might be able to help you more but as far as the error goes the wrong port being configured might be the issue.
The error EADDRINUSE means the port you’re trying to use (in this case, 5000 or previously 3000) is still occupied by another process.
Windows:
netstat -ano | findstr :5000
(This checks if port 5000 is being used by another process.)
Linux:
sudo lsof -i:5000
(This checks if port 5000 is being used by another process.)
If the port is being used by a Node.js process, kill the process and rerun your project.
If another service is using the port, consider using a different port number.
To kill the process:
Windows:
taskkill /PID /F
(Replace with the process ID you found.)
Linux:
sudo kill -9
(Replace with the process ID you found.)
Note: Only kill the process if it is a Node.js process. If it’s another service, it’s better to choose a different port.