ExpressJS - throw er Unhandled error event

前端 未结 30 1956
囚心锁ツ
囚心锁ツ 2020-12-12 09:30

I created expressjs application using the following commands:

express -e folderName
npm install ejs --save
npm install

When I run the appli

30条回答
  •  悲哀的现实
    2020-12-12 10:14

    Reason for this error

    Some other process is already running on the port you have specified

    Simple and Quick solution

    On Linux OS, For example you have specified 3000 as the port

    • Open the terminal and run lsof -i :3000. If any process is already running on port 3000 then you will see this printing on the console

    COMMAND   PID  USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    node    16615 aegon   13u  IPv6 183768      0t0  TCP *:3000 (LISTEN)

    • Copy the PID (process ID) from the output

    • Run sudo kill -9 16615 (you have to put PID after -9)

    • Start the server again

提交回复
热议问题