. Advertisement .
..3..
. Advertisement .
..4..
For the problem “throw er; // unhandled ‘error’ event.” I tried to fix it, but It doesn’t work and returns the result I want. Here is my program:
express -e folderName
npm install ejs --save
npm install
and
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE
at errnoException (net.js:884:11)
at Server._listen2 (net.js:1022:14)
at listen (net.js:1044:10)
at Server.listen (net.js:1110:5)
at Object.<anonymous> (folderName/app.js:33:24)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
has occurred. I’ve checked the entire command line but still can’t find the mistake.
The cause: You have another server running on the same port, such as 8080. And this error happens perhaps because you had run node app in other shell, please close it and try again.
The solution: check PORT no. is available or not by using
You can also use the command lsof:
Sometimes, we get the same error when running our express app. In that instance, we need to do the same. It is necessary to verify that it is running on any terminal. These steps will help you find and kill the process.
OR
To close all running node processes, use one command