Node.js Port 3000 already in use but it actually isn't?

前端 未结 30 2075
闹比i
闹比i 2020-11-28 17:24

I have been working with a node.js project for a few weeks and it has been working great. Usually, I use npm start to run my app and view it in a browser on loc

相关标签:
30条回答
  • 2020-11-28 17:58

    I have spent 2h on finding out why EADDRINUSE wasn't allowing me to sart an app (other node-express servers were ok)... it started working after adding lazyConnect: true, to datasource configuration.

    Don't ask me why it helped. I do not know. I am putting this info here just for people having the same issue.

    0 讨论(0)
  • 2020-11-28 17:58

    In ubuntu first grab the process by using port number: sudo lsof -i:3000 then use kill command to kill the process, for example if the process PID is 4493 the use command: kill 4493 , for mac or windows find the related command

    0 讨论(0)
  • 2020-11-28 18:03

    It may be an admin process running in the background and netstat doesn't show this.
    Use tasklist | grep node to find the PID of this admin process and then kill PID

    0 讨论(0)
  • 2020-11-28 18:05

    For windows, The Task Manager would definitely show a node process running. Try to kill the process, it will solve the problem.

    0 讨论(0)
  • 2020-11-28 18:06

    Maybe you can take this as reference. This single command line can kill the process running on given port.

    npx kill-port 3000
    


    To kill multiple ports.

    npx kill-port 3000 8080 4200
    
    0 讨论(0)
  • 2020-11-28 18:06

    I had the same problem. (The below steps work fine on Windows 10):

    1. Open Task manager (press Ctrl+Alt+Delete)
    2. Select the 'Processes tab'
    3. Search for 'Node.js: Server-side JavaScript'
    4. Select it and click on 'End task' button

    Now you can run npm start.

    Hope it helps you.

    0 讨论(0)
提交回复
热议问题