skip to Main Content

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


  1. 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.

    Login or Signup to reply.
  2. The error EADDRINUSE means the port you’re trying to use (in this case, 5000 or previously 3000) is still occupied by another process.

    1. Verify if the port is still occupied using the command line:
      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.)

    1. If the port is occupied, either kill the process or use a different port:
      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.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search